UUOCON page# 0001 next
2: COMMENT ⊗   VALID 00149 PAGES
3: C REC  PAGE   DESCRIPTION
4: C00001 00001
5: C00014 00002    UUOCON  NON-IO SECTION
6: C00017 00003    HERE WE FIGURE OUT WHOSE FAULT THE UUO IS AND WHO IT IS FOR
7: C00020 00004    UUO SETUP ROUTINES FOR P2
8: C00022 00005    HERE WE TELL THE WORLD WE HIT A UUO AT INTERUPT LEVEL AND TRY
9: C00024 00006    SAVE USER'S ACS, GET A PDL
10: C00026 00007    HERE WE SET UP A CHANNEL AND DISPATCH
11: C00029 00008    USRXIT  - WE RETURN HERE EVENTUALLY TO CHECK WITH SCHEDULER
12: C00032 00009    RESTORE ACS AND DISMISS UUO 
13: C00035 00010    GET HERE WHEN UUOPTR≠0 TO THINK ABOUT LETTING LOSER SIMULATE UUO
14: C00037 00011    ROUTINE TO ASSIGN A CHANNEL NUMBER
15: C00039 00012    TABLE OF UUO DISPATCH ADDRESSES
16: C00041 00013    IOT UUO DISPATCH TABLE
17: C00043 00014    CALL AND CALLI
18: C00046 00015    CALL UUO DISPATCH TABLE
19: C00049 00016     THE FOLLOWING ARE STANFORD'S OWN PRIVATE CALLI'S
20: C00055 00017     MACROS TO DEFINE CALLI TABLES
21: C00056 00018    EXIT UUO ROUTINE
22: C00058 00019    SETPOV - SET PUSH DOWN OVERFLOW TRAP
23: C00059 00020    RESET UUO ROUTINE
24: C00062 00021     ROUTINE TO RESET ONE'S UPPER SEGMENT
25: C00063 00022    APRDKL  ROUTINE TO KILL ANY CLOCK INTERRUPT REQUESTS FOR JOB J
26: C00064 00023    APRENB - ROUTINE TO SET UP APR FOR USER TRAPPING
27: C00066 00024    PJOB, DATE, DAYCNT, ACCTIM, DSKTIM, JOBTIM, MSTIME UUO'S
28: C00068 00025    SLEEP   PUT JOB TO SLEEP FOR NSECONDS
29: C00069 00026    SWITCH  RETURN DATA SWITCHES
30: C00070 00027    DVCHR, DEVNUM
31: C00072 00028    GETPPN -- DSKPPN
32: C00076 00029    SETNAM, SETCRD, SETDDT, GETNAM
33: C00078 00030    WAIT FOR IO TO BECOME INACTIVE ON CHANNEL AC
34: C00079 00031    GETLN:  PUSHJ PDP,TTYFND        GET NAME OF TTY
35: C00080 00032    CRKSER -- READ THE PETIT CROCK, J. SAUTER, REST OF PAGE.
36: C00082 00033     FINISH READING PCROCK, CONVERT TO STANDARD FORM
37: C00084 00034    LOGIN UUO.      FOR LOGIN CUSP ONLY.
38: C00088 00035     ROUTINE TO SET UP SCHEDULER DATA STRUCTURE FOR A JOB
39: C00089 00036    SETPRV, GETPRV
40: C00092 00037    GET A PPN'S SERVICE LEVEL RESERVATION.
41: C00099 00038    LOGOUT UUO
42: C00100 00039     ROUTINE TO READ SPACEWAR BUTTONS
43: C00101 00040     ROUTINE TO COMPLEMENT STATE OF DUPLEXING
44: C00102 00041     ROUTINE TO GET A WORD FROM MONITOR CORE
45: C00103 00042     RUN A JOB UUO
46: C00105 00043     SWAP UUO - CONTINUED . . .
47: C00108 00044     SWAP UUO - LOG IN NEW JOB AND RUN THIS ON IT - PHANTOM STARTUP
48: C00112 00045     ROUTINE TO DO THE GETTING OF A JOB FROM UUO LEVEL
49: C00115 00046     ROUTINE TO SAVE ACCUMULATORS OVER RUNJOB UUO
50: C00117 00047     EIOTM AND LIOTM UUO'S
51: C00118 00048     UUO TO GET THE PHYSICAL NAME OF A DEVICE
52: C00119 00049     GET A JOB'S JOB STATUS WORD
53: C00120 00050     GET A TELETYPE'S DEVIOS
54: C00122 00051    COMMENT $               WAKEME
55: C00125 00052    TRANSLATE SYSTEM CALL TO/FROM SIXBIT.
56: C00128 00053    CALTU:  ANDI TAC1,777000
57: C00130 00054    CALT2:  MOVSI TAC1,-IUUMAX*2-40 TOTAL # MAJOR OPCODES
58: C00132 00055    SETPR2, BEGIN SEGUUO
59: C00134 00056     HERE WE ADDRESS CHECK HIS PR REQUEST
60: C00135 00057    GETPR2
61: C00136 00058     REMAP UUO . . .
62: C00138 00059     REMAP - CHECK IF HE WANTS IT WRITE PROTECTED
63: C00140 00060     REMAP - IF HE IS NOT ON 1K BOUNDARY, ADJUST HIM
64: C00143 00061    BLTUP - FAST UPWARDS BLT
65: C00145 00062    HERE WE ITERATE ON BLTS, POSSIBLY STARTING WITH A SMALLER ONE
66: C00147 00063     UUO TO SET OR CLEAR USER WRITE-PROTECT BIT
67: C00148 00064    UNPURE - MAKE A WRITEABLE COPY OF WRITE-PROTECTED UPPER, IF NECESSARY
68: C00152 00065    UNPURE CONTINUED:
69: C00155 00066     CORE UUO FOR HIGH SEGMENTS
70: C00158 00067     CORE2 - SCAN FOR ALL JOBS USING THIS SEGMENT AND TELL THEM HE HAS CHANGED SIZE
71: C00159 00068     ATTACH HIGH SEGMENT
72: C00162 00069    ATTSEG   SEARCH FOR A SEGMENT OF A GIVEN NAME
73: C00163 00070    DETSEG  DETACH SEGMENT
74: C00166 00071     DETSEG - COMMON SEGMENT UUO EXIT ROUTINE
75: C00167 00072     GET NUMBER OF SEGMENT BELONGING TO JOB N
76: C00168 00073     SEGSIZ CALLING . . .
77: C00169 00074     SETNM2 CALLING . . .
78: C00171 00075     ROUTINE TO GET YOUR SEGMENT'S NAME
79: C00172 00076     THIS UUO FIRST KILLS ANY HIGH SEGMENT YOU MAY HAVE.
80: C00173 00077     RETURNS LIST OF JOB NUMBERS WHO POINT TO YOUR UPPER SEGMENT.
81: C00174 00078     SET PROTECTION ON A HIGH SEGMENT
82: C00176 00079            SUBTTL  INTUUO - UUOS FOR NEW STYLE INTERRUPT SYSTEM
83: C00177 00080     INTENB
84: C00179 00081     CLKENB, CLKENA  - ENABLE FOR USER CLOCK INTERRUPTS
85: C00183 00082     INTORM - ROUTINE TO SET BITS IN INTERUPT ENABLE MASK
86: C00184 00083     INTACM - CLEARS BITS IN INTERRUPT ENABLE MASK
87: C00185 00084     INTENS, INTIIP - ROUTINES TO GIVE BACK INFORMATION
88: C00186 00085     INTIRQ - TELLS YOU WHAT INTERRUPTS ARE PENDING
89: C00187 00086     DISMIS - TERMINATES CURRENT I-LEVEL RUN
90: C00189 00087     INTGEN - ROUTINE TO GENERATE AN INTERRUPT FOR YOURSELF
91: C00190 00088     USKIP - ROUTINE TO TELL USER IF HE IS INSIDE A UUO
92: C00191 00089     UWAIT - WAITS FOR UUO TO TERMINATE
93: C00193 00090     DEBREAK - MAKES I-LEVEL PROCESS TAKE PLACE OF U-LEVEL PROCESS
94: C00194 00091     IWAIT - GO INTO INTERRUPT WAIT UNTIL AWAKENED BY AN APPROPRIATE INTERRUPT
95: C00195 00092     ROUTINE TO ENABLE INTERRUPTS AND THEN GO INTO INTERRUPT WAIT
96: C00196 00093    UUOS TO SET THE INTERRUPT MASK
97: C00198 00094    IMSKST  IMSKCL
98: C00199 00095     CLKINT UUO  (CLKUUO) START UP A CLOCKED I-LEVEL JOB
99: C00204 00096    INTUUO - INTDEJ, IMSTW
100: C00206 00097     IWKMSK, IMSKCR
101: C00207 00098     INTDMP
102: C00209 00099     INTDMP - ERROR RETURNS
103: C00210 00100     ROUTINE TO GET A JOB NUMBER FROM A JOB NAME
104: C00211 00101     INTIPI
105: C00213 00102    SUBTTL  UUOCON - STANFORD SPECIAL IO ROUTINES
106: C00214 00103    THIS UUO GETS THE STANDARD BUFFER LENGTH FOR A DEVICE
107: C00215 00104     ROUTINE TO GET THE TIME CELLS AND CLEAR THEM
108: C00217 00105    RETURNS A CODE TELING WHETHER A JOB NAME IS LOGGED IN
109: C00219 00106     DEVUSE - HOW MANY JOBS ARE WAITING FOR A PARTICULAR DEVICE.
110: C00223 00107     JOBRD  UUO TO BLT DATA FROM SOME OTHER JOB'S CORE IMAGE TO YOURS.
111: C00226 00108     JOBRD - PICK UP ADDRESS OF LAST WORD, ADDRESS CHECK IT
112: C00228 00109     JOBRD - GET FREE STORAGE FOR DATA, PLANT CLOCK REQUEST TO DO TRANSFER
113: C00230 00110     JOBRD - WE GET HERE AT CLOCK LEVEL . . .
114: C00234 00111    TMPCOR UUO - BEHAVES AS DESCRIBED IN DEC MANUAL
115: C00238 00112    CHECK & RELOCATE TMPCOR WCMA
116: C00240 00113    WRITE TMPCOR FILE
117: C00243 00114    UUOCON  IO SECTION
118: C00245 00115    IOPUSH, IOPOP, IOPDL
119: C00250 00116     CLOSE UUO - CALLING SEQUENCE
120: C00251 00117     CLOSE CODE - WAIT FOR IO TO FINISH, FLUSH BUFFERS
121: C00254 00118     CLOSE CODE
122: C00257 00119     CLOSE - CALL DEVICE DEPENDENT ROUTINE
123: C00258 00120     INBUF - CALLING SEQUENCE
124: C00259 00121     SET UP BUFFERS OF USER-SPECIFIED LENGTH
125: C00261 00122     UINBF - CALLING SEQUENCE . . .
126: C00263 00123    ERROR MESSAGES FOR INBUF, OUTBUF, UINBF, AND UOUTBF UUOS
127: C00264 00124    OPEN UUO - PERFORMS SAME OPERATION AS INIT
128: C00265 00125     INIT - CALLING SEQUENCE
129: C00267 00126     INIT CODE - FIRST FIND DEVICE AND TRY TO ASSIGN IT
130: C00274 00127     HERE WE ASK HIM IF HE IS WILLING TO WAIT FOR THE DEVICE
131: C00277 00128     DEVICE WAIT - CAN'T GET IT, SEE IF HE WANTS DISK
132: C00278 00129    CALLING SEQUENCE
133: C00279 00130    LONG DISPATCH TABLE UUOS - GET HERE ONLY IF DEVICE HAS LONG
134: C00281 00131    RENAME UUO - HERE ON SHORT DISPATCH TABLE DEVICES TOO
135: C00283 00132    INPUT UUO
136: C00285 00133     HERE IF INPUT NEEDS LOOKUP. GET FILE NAME FROM LOSER.
137: C00287 00134     INPUT UUO - HERE, WE ARE SATISFIED DEVICE IS PROPERLY LOOKED UP
138: C00290 00135     INPUT UUO CONT.
139: C00292 00136    HERE ON FIRST INPUT AFTER INIT, INIT & LOOKUP, OR INIT & LOOKUP & INPUT
140: C00294 00137     CALL THE DEVICE INPUT ROUTIN
141: C00296 00138     OUTPUT UUO - CALLING SEQUENCE
142: C00299 00139    HERE ON OUTPUT UUO
143: C00301 00140     OUTPUT UUO - HERE WE ARE SATISFIED DEVICE HAS BEEN PROPERLY ENTERED
144: C00304 00141     OUTPUT UUO - HERE, WE ADVANCE BUFFER ADDRESS, START OUTPUT, AND WAIT FOR
145: C00308 00142     SUBROUTINE FOR OUTPUT UUO
146: C00309 00143    RELEASE A DEVICE
147: C00313 00144     RELEAS CODE - SEE IF THERE IS ANYONE WAITING FOR THE DEVICE
148: C00314 00145     UUOS TO TEST IO STATUS WORD
149: C00315 00146     MORE STATUS UUOS
150: C00316 00147     STILL MORE STATUS UUOS
151: C00317 00148    IN UUO - LIKE INPUT     SKIPS IF  EOF OR ERRORS
152: C00318 00149    SPACEWAR UUOS
153: C00319 ENDMK
154: C⊗;
    UUOCON page# 0002 next  prev
156: SUBTTL  UUOCON  NON-IO SECTION
157: ;UUOCON (BOTH SECTIONS) CONSISTS OF THE UUO TRAP HANDLER
158: ;THE CALL UUO ROUTINES AND THE IO UUO ROUTINES
159: ;SOME UUO DO DISPATCH TO OTHER ROUTINES OUTSIDE OF UUOCON
160: ;ALL UUOS DROP THEMSELVES IN REAL LOCATION 40, AND TRAP TO 41.
161: 
162: ;SYSTEM UUOS(40-77) FIRST SAVE THE USERS ACS IN RELATIVE LOC 0-17
163: ;THEN THE FOLLOWING ACS ARE LOADED UP BEFORE DISPATCHING:
164: ;       PDP     ;PUSHDOWN LIST IN CURRENT JOB DATA AREA
165: ;       PROG    ;CURRENT JOB RELOCATION IN RH,PROTECTION IN LH
166: ;       JDAT    ;ADDRESS OF CURRENT JOB DATA AREA
167: ;       UUO     ;THE CONTENTS OF LOC 40 WITH PROG IN INDEX FIELD
168: ;               ;SO THAT RELOCATION CAN BE DONE FOR PICKING UP ARGUMENTS
169: ;       DEVDAT  ;ADR. OF DEVICE DATA BLOCK
170: ;       IOS     ;DEVICE IO STATUS WORD
171: ;       DSER    ;ADR. OF DEVICE SERVICE ROUT. DISPATCH TABLE
172: ;       UCHN    ;THE USER IO CHANNEL(AC FIELD) OF UUO
173: 
174: ;RETURN IS PUT IN UUOPC(JOB)
175: ;THEN IF CALL WAS FROM USER MODE, THE UUO ROUTINE IS CALLED
176: ;WITH A PUSHJ, SO THAT ALL UUO ROUTINE RETURN WITH A POPJ PDP,
177: ;WHICH WILL RETURN CONTROL TO UUOCON WHICH WILL RESTORE USERS
178: ;ACS AND RETURN TO HIM
179: ;IF THE CALL IS FROM EXEC MODE, THE UUO ROUTINE IS CALLED
180: ;BY DOING JUST A JRST,  WHEN THE UUO ROUTINE RETURNS WITH
181: ;A POPJ, IT WILL RETURN TO THE EXEC WITHOUT RESTORING
182: ;ANY ACS
183: ;CONTROL MAY ALWAYS BE RETURNED BY EXECUTING A
184: ;       POPJ    P,
185: ;WHICH WILL RESTORE THE ACS, APR BITS, AND RETURN.
186: ;THE UUO HANDLER IS PURE IF THE FOLLOWING RESTRICTIONS ARE OBSERVED.
187: ;RESTRICTIONS: UUOS CANNOT BE CALLED BY INTERRUPT SERVICE ROUTINES.
    UUOCON page# 0003 next  prev
189: ;HERE WE FIGURE OUT WHOSE FAULT THE UUO IS AND WHO IT IS FOR
190: 
191: UUO1:  MOVEM   17,UUO.SA+17            ;SAVE ALL AC'S FOR ILLUUO FROM EXEC
192:         MOVEI   17,UUO.SA
193:         BLT     17,UUO.SA+16
194:         MOVE    17,UUO.SA+17            ;RESTORE AC 17
195:         CONSO   PI,1778                ;ARE WE AT INTERRUPT LEVEL?
196:         JRST    NOPCK                   ;NO.
197:         EXCH    TAC,UUO0+P1PID          ;SAVE TAC, GET PC OF UUO + 1
198:         TLNN    TAC,USRMOD              ;USER MODE?
199:         JRST    UUOX                    ;UUO FROM EXEC WHILE PI IN PROG - ILLEGAL
200:         EXCH    TAC,UUO0+P1PID          ;RESTORE TAC
201: NOPCK:  SKIPN   SPWUUF                  ;ARE WE RUNNING SPACEWAR NOW?
202:         JRST    UUO1B                   ;NO.
203:         MOVEM   17,SPWSAC+17
204:         MOVEI   17,SPWSAC
205:         BLT     17,SPWSAC+16            ;STUFF THE SPACEWARE AC'S AWAY.
206:         MOVEI   PID,P1PID
207:         JRST    SPWUUO                  ;LET SPWSER PROCESS IT
208: 
209: UUO1B:  MOVEM   17,USRSAV+P1PID         ;SAVE AC 17
210:         MOVE    17,UUO0+P1PID           ;GET PROCESSOR FLAGS
211:         TLNE    17,USRMOD               ;IS UUO FROM MONITOR?
212:         JRST    UUO1A                   ;NO. ORDINARY FROM USER MODE
213:         MOVE    DAT,UUO0+P1PID          ;UUO FROM EXEC
214:         MOVEI   PID,P1PID
215:         MOVE    UUO,@UUOLOC(PID)
216:         MOVE    J,JOB(PID)
217:         JRST    UUOSY1                  ;UUO FROM SYSTEM
218: 
219: UUO1A: SKIPE   17,JOBADR+P1PID         ;GET JOB DATA AREA ADDRESS
220:         JRST    UUOSYS                  ;HAPPY
221:         MOVEI   PID,P1PID               ;NO JOB DATA AREA
222:         JRST    NULJB                   ;MUST BE AILING NULL JOB
223: 
224: UUO3:  EXCH    TAC,UUO2+P1PID          ;TRAP TO LOCATION 60.
225: IFN FTXCTR,<
226:         TLNN TAC,USRMOD
227:         JRST PGRSM                      ;SIMULATE XCTRS
228: ↑UUO3A:>
229:         MOVEM   TAC,UUO0+P1PID          ;ILLEGAL FOR NOW.
230:         MOVE    TAC,UUO2+P1PID          ;RESTORE TAC.
231:         SETZM   @UUOLOC+P1PID           ;MAKE LOOK LIKE ILL INSTR.
232:         JRST    UUO1                    ;TRAPPING TO 40.
    UUOCON page# 0004 next  prev
234: ;UUO SETUP ROUTINES FOR P2
235: 
236: P2UUO1:
237:         CONSO   PI,1778                ;INTERRUPT LEVEL?
238:         JRST    P2NOPCK                 ;NO.
239:         EXCH    TAC,UUO0+P2PID
240:         TLNN    TAC,USRMOD              ;FROM USER MODE?
241:         JRST    P2UUOX                  ;NO, LOSE
242:         EXCH    TAC,UUO0+P2PID
243: P2NOPCK:SKIPN   SPWUUF+P2PID
244:         JRST    P2UU1B                  ;NOT SPACEWAR LEVEL
245:         MOVEM   17,SP2SAC+17
246:         MOVEI   17,SP2SAC
247:         BLT     17,SP2SAC+16            ;SAVE SPACEWAR AC'S
248:         MOVEI   PID,P2PID
249:         JRST    SPWUUO                  ;LET SPWSER THINK ABOUT THIS
250: 
251: P2UU1B: MOVEM   17,USRSAV+P2PID         ;SAVE AC 17
252:         MOVE    17,UUO0+P2PID           ;GET PROCESSOR FLAGS
253:         TLNE    17,USRMOD               ;IS UUO FROM MONITOR?
254:         JRST    P2UU1A                  ;USER LEVEL UUO
255:         MOVE    DAT,UUO0+P2PID          ;SYSTEM UUO
256:         MOVEI   PID,P2PID
257:         MOVE    UUO,@UUOLOC(PID)
258:         MOVE    J,JOB(PID)
259:         JRST    UUOSY1
260: 
261: P2UU1A:
262:         SKIPE   17,JOBADR+P2PID         ;GET JOB DATA AREA ADDRESS
263:         JRST    U2OSYS                  ;THERE IS ONE.
264:         MOVEI   PID,P2PID               ;NO CORE FOR JOB
265:         JRST    NULJB                   ;MUST BE AILING NULL JOB
266: 
267: P2UUO3:
268:         EXCH    TAC,UUO2+P2PID          ;TRAP TO LOCATION 60.
269:         MOVEM   TAC,UUO0+P2PID          ;ILLEGAL FOR NOW.
270:         MOVE    TAC,UUO2+P2PID          ;RESTORE TAC.
271:         SETZM   @UUOLOC+P2PID           ;MAKE LOOK LIKE ILL INSTR.
272:         JRST    P2UUO1                  ;TRAPPING TO 40.
    UUOCON page# 0005 next  prev
274: ;HERE WE TELL THE WORLD WE HIT A UUO AT INTERUPT LEVEL AND TRY
275: ;TO FIGURE OUT WHAT TO DO!
276: 
277: UUOX:   EXCH    TAC,UUO0+P1PID          ;RESTORE TAC, UUO0
278:         CONO    PI,PIOFF                ;HOLD EVERYTHING
279:         EXCH    P,ERRPD+P1PID           ;GET A PDL
280:         PUSHACS
281:         MOVEI   PID,P1PID
282:         JRST    UUOX1
283: 
284: P2UUOX: EXCH    TAC,UUO0+P2PID
285:         CONO    PI,PIOFF
286:         EXCH    P,ERRPD+P2PID
287:         PUSHACS
288:         MOVEI   PID,P2PID
289: UUOX1:  SOS     UUO0(PID)               ;FIX UP ADDRESS FOR PRINTING AND RETURN
290:         PUSHJ   P,DISMES
291:         ASCIZ /ILLEGAL UUO FROM EXEC WHILE PI IN PROGRESS
292: PI = /
293:         CONI    PI,TAC
294:         PUSHJ   P,DISLOC
295:         PUSHJ   P,DISERR
296:         [ASCIZ/
297: P  = /]
298:         DISARG OCT,<ERRPD(PID)> ;OLD STACK
299:         [ASCIZ/    C(P) = /]
300:         -1
301:         HRRZ    TAC,ERRPD(PID)
302:         MOVE    TAC,(TAC)
303:         PUSHJ   P,DISOCT
304:         PUSHJ   P,DISERR
305:         [ASCIZ/
306: PC = /]
307:         DISARG OCT,<UUO0(PID)>
308:         [ASCIZ/    UUO  = /]
309:         DISARG OCT,<@UUOLOC(PID)>
310:         [ASCIZ/
311: (WILL RETURN VIA JRST 2,@UUO0)
312: /]
313:         -1
314:         PUSHJ P,SYSFIX
315:         JFCL                            ;COULDN'T FIX ERROR
316:         CAIA
317:         JRST    UUOX2                   ;FIXED AN ERROR
318:         PUSHJ   P,DISFLUSH
319:         PUSHJ   P,DDTCALL
320: UUOX2:  JUMPN   PID,P2UUX2
321:         POPACS
322:         EXCH    P,ERRPD(PID)
323:         CONO    PI,PION
324:         JRST    2,@UUO0+P1PID           ;TRY TO GO ON!
325: 
326: P2UUX2: POPACS
327:         EXCH    P,ERRPD(PID)
328:         CONO    PI,PION
329:         JRST    2,@UUO0+P2PID
    UUOCON page# 0006 next  prev
331: ;SAVE USER'S ACS, GET A PDL
332: 
333: U2OSYS: MOVEM   16,16(17)
334:         MOVEI   16,(17)
335:         BLT     16,15(17)
336:         MOVE    TAC,USRSAV+P2PID
337:         MOVEM   TAC,17(17)
338:         MOVEI   PID,P2PID
339:         JRST    UUOSY2
340: 
341: UUOSYS: MOVEM   16,16(17)               ;STORE AC16 IN USER 16
342:         MOVEI   16,(17)                 ;SET UP BLT POINTER
343:         BLT     16,15(17)               ;MOVE REAL AC'S TO USER AREA
344:         MOVE    TAC,USRSAV+P1PID        ;MOVE USER 17 TO USER'S AREA
345:         MOVEM   TAC,17(17)
346:         MOVEI   PID,P1PID
347: UUOSY2: MOVE    PROG,17                 ;LOAD UP POINTER TO USER PROGRAM AREA
348: IFN JDMPRG,<
349:         MOVE    JDAT,JOBDAT(PID)        ;ADDRESS OF JOB DATA AREA
350: >
351:         MOVE    J,JOB(PID)              ; PICK UP JOB NUMBER
352:         MOVE    DAT,UUO0(PID)           ; SAVE RETURN IN ACS
353:         MOVE    UUO,@UUOLOC(PID)        ; AND SAVE UUO ALSO
354:         SKIPE   INTACT(PID)
355:         SKIPA   P,INTSP(PID)            ;USE INTERRUPT LEVEL PDL
356:         JSP     TAC,GETPDL              ; GET US A PDL
    UUOCON page# 0007 next  prev
358: ;HERE WE SET UP A CHANNEL AND DISPATCH
359: 
360: UUOSY1:EXCH    DAT,UUOPC(J)            ; SAVE RETURN
361:         MOVEM   DAT,UUOOPC(J)           ; SAVE OLD RETURN IN CASE ILL. UUO INSIDE UUO CODE.
362:         SKIPE DAT,UUOPTR(J)
363:         JRST UUOSY4                     ;MAYBE LOSER WANTS TO SIMULATE IT
364: UUOSY3: TLNN    UUO,740000              ;SYSTEM UUO?
365: ILEGAL: JRST    UUOERR                  ;NO, 0-37 ARE ILLEGAL,PRINT ERROR
366:         TLO     UUO,PROG                ;SET FOR RELOCATION
367:         LDB     UCHN,PUUOAC             ; SETUP USER DEVICE CHANNEL NUMBER
368:         LDB     TAC1,[POINT 9,UUO,8]    ;PICK UP UUO OP CODE
369:         XORI    TAC1,700                ; IS THIS AN IOT UUO?
370:         TRCN    TAC1,700
371:         JRST    UUOIOT                  ; YES, SEPARATE DISPATCH TABLE
372:         CAIL    TAC1,100                ;ILLEGAL INSTRUCTION?
373:         JRST    ILLINS                  ;YES, STOP JOB AND PRINT ERROR
374:         PUSHJ   P,CHNSET                ; CHECK CHANNEL NUMBER AND LOAD IOS AND DSER
375:         JRST    USRXIT                  ; NO CHANNEL, BUT UUO LEGAL ANYWAY
376:         JRST    USRXT1                  ; THINGS LIKE LOOKUP AND ENTER ON NON-DIRECTORY DEVICES GET HERE
377:         ROT     TAC1,-1                 ;DIVIDE UUO OPCODE BY 2, SAVE REMAINDER
378:         MOVE    DAT,UUOTAB-20(TAC1)     ;GET DISPATCH TABLE ENTRY
379: DISP4:  TLNN    TAC1,400000             ;WAS UUO ODD?
380:         MOVS    DAT,DAT                 ;NO, USE LH OF DISPATCH ENTRY
381:         AOS     NUUOS
382:         PUSHJ   P,(DAT)                 ;NO, FROM USER. ROUTINES ALL RETURN BY POPJ
383:                                         ;BEGINNING HERE WE WON'T TAKE USER INTS
384: USRXT0:
385:         JRST    USRXIT                  ;NO SKIP RETURN REQUIRED
386:         JRST    USRXT1
387:         MOVE    J,JOB(PID)
388:         AOSA    UUOPC(J)
389: USRXT1: MOVE    J,JOB(PID)
390:         AOS     UUOPC(J)                ; SKIP RETURN TO USER
    UUOCON page# 0008 next  prev
392: ;USRXIT  - WE RETURN HERE EVENTUALLY TO CHECK WITH SCHEDULER
393: ; TO SEE IF IT WANTS TO RESCHEDULE THIS JOB
394: 
395: USRXIT:MOVE    J,JOB(PID)
396:         SKIPN   SPWUUF(PID)             ;ARE WE AT SPACEWAR LEVEL ?
397:         JRST    USRXT6                  ;NO.
398:         MOVE    TAC,UUOPC(ITEM)
399:         POP     P,UUOPC(J)              ; RESTORE OLD PC WORD
400:         MOVEM   TAC,UUO0(PID)
401:         JUMPE   PID,USRXT7
402:         MOVSI   17,SP2SAC
403:         BLT     17,17
404:         XCT     SPWXCT+P2PID            ;USUALLY JRST 2,@UUO0+P2PID
405: 
406: USRXT7: MOVSI   17,SPWSAC               ; RESTORE SPW ACS
407:         BLT     17,17
408:         XCT     SPWXCT                  ;USUALLY JRST 2,@UUO0 ;RETURN TO SPW JOB
409: 
410: USRXT6: SKIPE   INTACT(PID)             ;USER INTERRUPT LEVEL?
411:         JRST    USRXT4                  ;YES, SKIP SCHEDULING CHECK
412:         SKIPL   TAC,JBTSTS(J)           ;STILL RUNNABLE?
413:         JRST    USRXT9                  ;NO - RUN BIT OFF - PUT HIM IN STOPQ
414:         TLNE    TAC,STOPIO              ;YES?
415: USRXT2: PUSHJ   P,USRXTS                ;NO, CAUSE CLK INT ON EXIT
416:         MOVSI   UCHN,INTWAIT            ;ARE WE ENABLED FOR INTERRUPT WAIT INTERRUPT?
417:         TDNN    UCHN,JBTIEN(J)
418:         JRST    USRXT4                  ;NOT ENABLED FOR INT-WAIT INTERRUPT
419:         SETOM   INTHLD(PID)             ;MAKE SURE WE DON'T GET TO INTNOW FROM HERE
420:         IORM    UCHN,JBTIRQ(J)
421:         SETZM   INTHLD(PID)             ;INTNOW WILL WIN NOW
422:         SETOM   INTREQ(PID)
423: USRX4A: PUSHJ   P,USRXTS                ;INT ON WAY BACK TO LOSER
424: USRXT4: MOVEI   DAT,USRXT5
425:         EXCH    DAT,UUOPC(J)
426:         TLNN    DAT,USRMOD
427:         JUMPN DAT,@DAT          ;RETURN DIRECT IF EXEC MODE, UNLESS 0 (EXIT UUO)
428: REPEAT 0,<
429:         MOVSI   AC1,RUN2
430:         SKIPN   PID
431:         MOVSI   AC1,RUN1
432:         TDNN    AC1,JB2STS(J)
433:         PUSHJ   P,PSWITCH
434: >
    UUOCON page# 0009 next  prev
436: ;RESTORE ACS AND DISMISS UUO 
437: 
438:         MOVEM   DAT,UUO0(PID)
439:         MOVE    JDAT,JBTADR(J)          ; MAKE SURE USER'S RELOCATION IS SET UP
440:         MOVSI   17,JOBAC(PROG)          ;RESTORE ALL USER ACS
441:         JUMPE   PID,USRXT8
442:         BLT     17,17
443:         XCT     UUOXIT+P2PID            ;JEN @UUO0+P2PID OR CONO PI,PIOFF
444:         SETOM   CLKFLG+P2PID            ;CAUSES TRAP TO CLKIN0 INSTEAD OF CLKINT
445:         SETOM SCHEDF+P2PID
446:         CONO    PI,PION!4000!<200-CLKCHN>
447:         CONSO   PI,77000
448:         JRST    CL2IN0
449:         JRST    10,.-2
450: 
451: USRXT8: BLT     17,17
452:                                 ; JEN WILL RESTORE FLAGS AND RETURN TO USER
453:                                 ;DISMISS INTERRUPT ONLY ON TRPJEN UUO
454:                                 ;IN ALL OTHER CASES NO INTERRUPTS
455:                                 ;IN PROGRESS
456:         XCT     UUOXIT          ;JEN @UUO0 OR CONO PI,PIOFF
457:         SETOM   CLKFLG          ;HERE WITH INTS OFF IF CLOCK HAS TICKED (SEE CLKINT)
458:         SETOM SCHEDF            ;IN CASE OF 0 PC FROM EXIT
459:         CONO    PI,PION!4000!<200-CLKCHN>      ;NOW (GOES TO CLKIN0 SINCE CLKFLG<0)
460:         CONSO   PI,77000        ;GET HERE ON TRPJEN (ALREADY IN PROGRESS)
461:         JRST    CLKIN0          ;CH7, JUST GO
462:         JRST    10,.-2          ;HIGHER CHN, DISMISS (SHOULDN'T RETURN)
463: 
464: ;ROUTINE TO FORCE CLOCK BREAK UPON RETURN TO USER
465: ;ONLY CALL WHEN NEARLY READY TO EXIT FOR INTNOW TO WORK.
466: USRXTS: MOVE    TAC,[CONO PI,PIOFF]
467:         MOVEM   TAC,UUOXIT(PID)
468:         POPJ    P,
469: 
470: ;GET HERE IF RUN BIT WAS OFF
471: USRXT9: MOVNI   TAC,STOPQ
472:         MOVEM   TAC,JOBQUE(J)
473:         JRST    USRXT2          ;GO FORCE SCHEDULE
474: 
475: USRXT5:                         ;BEYOND HERE USER INTS OK
476:         CONO    PI,PIOFF
477:         SETOM   DISFLAG
478:         PUSHJ   P,DISMES
479:         ASCIZ   /πππππEXITING UUOCON WITHOUT HAVING ENTERED UUOCON
480: /
481:         PUSHJ   P,DISFLUSH
482:         JRST    AUTOLOAD
    UUOCON page# 0010 next  prev
484: ;GET HERE WHEN UUOPTR≠0 TO THINK ABOUT LETTING LOSER SIMULATE UUO
485: ;UUOPTR POINTS TO TABLE (IN LOSER'S CORE) OF 3 3-WORD BLOCKS
486: ;EACH BLOCK LOOKS LIKE THIS:
487: 
488: ;WD0:   PLACE TO SAVE PC
489: ;WD1:   PLACE TO SAVE UUO ITSELF
490: ;WD2:   PC TO TRANSFER TO
491: 
492: ;THE FIRST BLOCK IS USED FOR PDP-10 MAIN PROGRAM UUOS, THE SECOND FOR PDP-10
493: ;INTERRUPT LEVEL UUOS, AND THE THIRD FOR PDP-10 SPACEWAR UUOS. NO PDP-6 UUOS
494: ;CAN BE SIMULATED.  IF EITHER WD1≠0 OR WD2=0 IN A GIVEN BLOCK, THOSE
495: ;UUOS ARE NOT GIVEN TO THE USER'S HANDLER.  THE WD1≠0 CONDITION HAS THE
496: ;EFFECT OF AUTOMATICALLY DISABLING SIMULATION WHILE IN THE SIMULATOR.
497: 
498: UUOSY4: SKIPE   INTACT(PID)     ;FIRST MAKE PNTR TO APPROP BLK
499:         ADDI    DAT,3
500:         SKIPE   SPWUUF(PID)
501:         ADDI    DAT,6
502:         XCTR    XR,[SKIPN 1(DAT)]       ;NOW SEE IF HE REALLY WANTS TO SIMULATE THIS
503:         XCTR    XR,[SKIPN TAC,2(DAT)]
504:         JRST    UUOSY3                  ;NOPE, WE'LL DO OUR THING AS USUAL
505:         XCTR    XW,[MOVEM UUO,1(DAT)]
506:         TLO     TAC,USRMOD
507:         EXCH    TAC,UUOPC(J)            ;SWAP PC'S AROUND
508:         XCTR    XW,[MOVEM TAC,(DAT)]
509:         JRST    USRXIT                  ;AND "RETURN" TO HIS SIMULATOR
510: 
511: SPWBLK←←6      ;TELL SPWSER WHERE TO LOOK
512: 
513: ;UUO TO SET UUOPTR TO ENABLE/DISABLE SIMULATOR
514: ;CALL:
515: ;       UUOSIM AC,
516: ;SETS UUOPTR TO C(AC)
517: 
518: UUOSIM: MOVEM   TAC,UUOPTR(J)
519:         POPJ    P,
    UUOCON page# 0011 next  prev
521: ;ROUTINE TO ASSIGN A CHANNEL NUMBER
522: 
523: CHNSET: POP     P,DAT                   ;POP UP RETURN ADDRESS
524:         SKIPE   DDB,USRJDA(UCHN)        ;GET ADRESS OF DEVICE DATA BLOCK
525:         CAMLE   UCHN,USRHCU(PID)        ;IS IT LESS THAN OR EQUAL TO HIGHEST
526:                                         ;USER IO CHANNEL IN USE FOR CURRENT JOB?
527:         JRST    NOCHAN                  ;CHANNEL NOT ASSIGNED
528: CHNSE1: MOVE    IOS,DEVIOS(DDB)         ;GET DATA BLOCK STATUS WORD
529:         MOVE    DSER,DEVSER(DDB)        ;SETUP IO SERVICE DISPATCH TABLE ADDRESS
530:         CAIL    TAC1,LNGUUO             ;LONG DISPATCH TABLE UUO?
531:         JRST    CHNSE3                  ;YES
532:         JRST    2(DAT)
533: 
534: NOCHAN: MOVE    TAC,UUOPC(J)            ;IS UUO FROM USER MODE?
535:         CAIGE   TAC1,IOUUO              ;IO UUO?
536:         JRST    CHNSE2                  ;NO.
537: REPEAT 0,<
538:         PUSHJ   P,GOTOP1                ;ALL IO DONE FROM P1
539: >
540:         TLNN    TAC,USRMOD
541:         JRST    CHNSE1                  ;EXEC MODE
542:         CAIE    TAC1,70                 ;YES,IS IT CLOSE OR RELEASE?
543:         CAIN    TAC1,71                 ;CLOSE AND RELEASE ALWAYS LEGAL
544:         JRST    (DAT)
545:         JRST    IOIERR                  ;NO, PRINT IO TO UNASSIGNED CHANNEL AND STOP JOB
546: 
547: CHNSE2: MOVEI DEVDAT,0          ;SET DEVDAT 0 TO FLAG NON-IO UUO
548:         JRST 2(DAT)             ;GO DISPATCH
549: 
550: CHNSE3: MOVE TAC,DEVMOD(DEVDAT) ;LONG DISPATCH TABLE UUO
551:         TLNE TAC,DVLNG          ;DOES THIS DEVICE HAVE A LONG DISPATCH TABLE?
552:         JRST 2(DAT)             ;YES, DISPATCH
553:         CAIGE TAC1,76           ;NO, IS UUO LOOKUP OR ENTER?
554:         JRST (DAT)              ;NO, RETURN TO USER
555:         JRST 1(DAT)             ;YES, SKIP RETURN TO USER
    UUOCON page# 0012 next  prev
557: ;TABLE OF UUO DISPATCH ADDRESSES
558: ;IN FORMAT:
559: ;       XWD 40,41
560: ;       XWD 42,43
561: ;       .
562: ;       XWD 76,77
563: ;THERE'D BETTER BE EXACTLY 40 ENTRIES HERE
564: 
565: DEFINE UUOS{FOR X IN(CALL,INIT,,SPCWAR,,,,<CALLI>       ;40-47
566: ,OPEN,<TTYUUO,TTYUUO>,,,,RENAME,<IN,TIN>,<OUT,TOUT>     ;50-57
567: ,<SETSTS,SETIOS>,STATO,<GETSTS,USTATS>,<STATZ>          ;60-63
568: ,<INBUF,UINBF>,<OUTBUF,UOUTBF>,<INPUT,IN>,<OUTPUT,UOUT> ;64-67
569: ,<CLOSE,CLOSE1>,<RELEAS,RELEA1>,MTAPE,<UGETF,UDGF>      ;70-73
570: ,<USETI,UDSI>,<USETO,UDSO>,<LOOKUP,UDLK>,<ENTER,UDEN>)} ;74-77
571: 
572: DEFINE UUOADR(C,A,B)
573: {IFE UUOPHZ,<DEFINE UUOAD1<0,A,B>;>XWD UUOAD2(C,\UUOAD1),UUOAD2(C,,A,B)
574: UUOPHZ←←1-UUOPHZ}
575: 
576: DEFINE UUOAD2!(C,X,A,B)
577: {IFIDN <A!B><><UUOERR+>IFDIF <B><><B+>IFDIF <A><><IFIDN <B><><C!A+>>0}
578: 
579: UUOPHZ←←0
580: UUOTAB: UUOS
581: {       UUOADR U,X
582: }
583: XP IOUUO,55                     ;LOWEST IO UUO(RENAME)
584: XP LNGUUO,72                    ;LOWEST LONG DISPATCH TABLE UUO
    UUOCON page# 0013 next  prev
586: ;IOT UUO DISPATCH TABLE
587: 
588: UUOIOT: SUBI TAC1,700           ; MAKE 700-777 INTO 0-77
589:         CAIL TAC1,2*IUUMAX      ; DOES THIS ONE EXIST?
590:         JRST ILLINS             ; NO, ILLEGAL INSTRUCTION
591:         AOS NIOTS               ; BUMP NUMBER OF IOT UUOS USED
592:         ROT TAC1,-1
593:         MOVE DAT,IUUTAB(TAC1)   ; PICK UP DISPATCH ADDRESS
594:         MOVEI DEVDAT,[SIXBIT /GARPLY/]  ;INIT. FOR ERROR PRINTOUTS.
595:         AOS NNUUOS              ; BUMP COUNT OF DISPATCHES
596:         JRST DISP4
597: 
598: DEFINE IUUOS{FOR X IN(<,CPOPJ>,DPYCLR,PPIOT,<UPGIOT>            ;700-703
599: ,<UINBF,MINBF>,<UOUTBF,MOUTBF>,<FBREAD,UFBRD>,<FBWRT,UFBWRT>    ;704-707
600: ,<MAIL,UMAIL>,PTYUUO,POINTS,<UPGMVE,UPGMOV>                     ;710-713
601: ,UPGMVM,PGIOT,CHNSTS,<CLKINT,CLKUUO>                            ;714-717
602: ,INTMSK,IMSKST,IMSKCL,INTUUO,IOPUSH,IOPOP,IOPDL)}               ;720-726
603: 
604: UUOPHZ←←0
605: IUUTAB: IUUOS
606: {       UUOADR ,X
607: }
608: IFN UUOPHZ,<UUOADR>
609: IUUMAX←←.-IUUTAB
610: 
611: ;UUO NAME TABLE, FOR FAIL, ETC.
612: 
613: IFE UUOPHZ,<IUUMAX*2,,UUOFLK;>IUUMAX*2-1,,UUOFLK ;LINK TO TABLES FOR TTYUUO, ETC.
614: UUONAM:UUOS
615: {       <SIXBIT ,X,>
616: }       IUUOS
617: {       <SIXBIT ,X,>
618: }
    UUOCON page# 0014 next  prev
620: ;CALL AND CALLI
621: ; CALLING SEQUENCE
622: ;       CALL D,[SIXBIT/NAME/]
623: ; WHERE NAME IS THE NAME OF A SYSTEM ROUTINE.
624: ; IF NO SYSTEM ROUTINE WITH THE SPECIFIED NAME IF FOUND, THIS ROUTINE
625: ; EXITS TO UUOERR.
626: ;CONTENTS OF USER AC PLACED IN AC TAC,UUO SET TO POINT
627: ;TO USER AC, PROG IN LH.
628: ;ITEM SET TO JOB NUMBER
629: 
630: 
631: 
632: UCALL:
633:         XCTR    XR,[MOVE DAT,(UUO)]     ;PICK UP NAME OF SYSTEM ROUTINE
634:         MOVSI   TAC1,-UCLLEN
635:         CAME    DAT,UCLTAB(TAC1)        ;SEARCH SYSTEM ROUTINE NAME TABLE
636:         AOBJN   TAC1,.-1
637:         TLZN    TAC1,-1                 ;CLEAR LH. WAS IT ZERO?
638:         JRST    UUOERR                  ;YES. RAN OUT OF TABLE
639:         JRST    UCALL1                  ;NO. DISPATCH.
640: 
641: 
642: ;CALLI UUO      -       CALL IMMEDIATE
643: ;CALLI D,E
644: ;WHERE E IS RELATIVE INDEX IN CALL TABLE
645: 
646: 
647: UCALLI:
648:         HRRZ    TAC1,UUO
649:         CAIL    TAC1,UCLDLN             ;EXCEED ?
650:         JRST    UCALL2                  ;YES. ERROR
651: UCALL1: POP     P,TAC                   ;REMOVE RETURN
652:         HRR     UUO,UCHN                ;UUO AC FIELD
653:         XCTR    XR,[MOVE TAC,(UUO)]     ;PICK UP CONTENTS OF USER AC
654:         ROT     TAC1,-1                 ;DIVIDE BY 2 AND SAVE REMAINDER
655:         MOVE    DAT,UCLJMP(TAC1)        ;GET DISPACTH TABLE ENTRY
656:         MOVE    J,JOB(PID)
657:         JRST    DISP4                   ;AND GO DISPATCH
658: 
659: UCALL2: TRZN    UUO,400000              ;IS HE ASKING FOR A STANFORD CALLI?
660:         JRST    UUOERR                  ;NO, SHOOT HIM!! BANG!
661:         MOVEI   TAC1,UCLDLN(UUO)
662:         CAIL    TAC1,UCLDLN             ;IF NOT BIGGER THAN THIS, FLUSH IT!
663:         CAIL    TAC1,UCLLEN             ;STILL TOO LARGE?
664:         JRST    UUOERR                  ;YES, FLUSH
665:         AOS     NSCALL                  ;BUMP NUMBER OF STANFORD CALLIS USED
666:         JRST    UCALL1
    UUOCON page# 0015 next  prev
668: ;CALL UUO DISPATCH TABLE
669: ;NEW UUOS MUST BE ADDED AT END SINCE CALLI DEPENDS ON
670: ;POSITION IN TABLE
671: ;ALSO NUMBER OF DEC CALLIS MUST BE EVEN
672: 
673: 
674: DEFINE NAMES!,<
675:         X RESET,RESETUUO        ;RESET IO
676:         X DDTIN,DDTIN           ;EXT-GET DDT CHAR.
677:         X SETDDT,SETDDT         ;SETDDT LOC IN PROTECTED JOB DATA
678:         X DDTOUT,DDTOUT         ;EXT:SEND DDT CHAR.
679:         X DEVCHR,DVCHR          ;DEVICE CHARACTISTICS
680:         X DDTGT,CPOPJ           ;GET DDT MODE
681:         X GETCHR,DVCHR          ;DEVICE CHAR.(DIFF. NAME)
682:         X DDTRL,CPOPJ           ;RELEASE DDT MODE
683: 
684:         X WAIT,WAIT             ;WAIT TILL DEVICE INACTIVE
685:         X CORE,CORUUO           ;CORE UUO
686:         X EXIT,EXIT             ;EXIT
687:         X UTPCLR,UTPCLR         ;CLEAR DEC TAPE DIRECTORY 
688:         X DATE,DATE             ;GET DATE
689:         X LOGIN,LOGIN           ;LOGIN
690:         X APRENB,APRENB         ;ENABLE APR FOR TRAPPING
691:         X LOGOUT,LOGOUT         ;LOGOUT
692: 
693:         X SWITCH,SWITCH         ;RETURN DATA SWITCHES
694:         X REASSIGN,REASSIGN     ;REASSIGN DEVICE TO ANOTHER JOB
695:         X TIMER,TIMER           ;RETURN JIFFY CLOCK TIME
696:         X MSTIME,MSTIME         ;RETURN TIME OF DAY IN MS
697:         X GETPPN,GETPPN         ;RETURN PROJECT-PROGRAMMER NUMBER
698:         X <>,UUOERR             ;TRPSET ILLEGAL
699:         X <>,UUOERR             ;TRPJEN ILLEGAL
700:         X RUNTIM,JOBTIM         ;RETURN TOTAL JOB RUNNING TIME
701: 
702:         X PJOB,JOBNO            ;RETURN JOB NUMBER
703:         X SLEEP,SLEEP           ;SLEEP FOR N SECONDS, THEN RETURN TO USER
704:         X SETPOV,SETPOV         ;SET PUSH DOWN OVERFLOW TRAP (FOR COMPAT ONLY)
705:         X PEEK,PEEK             ;PEEK INTO SYSTEM CORE.         ;JS
706:         X GETLN,GETLN           ;GET NAME OF TTY
707:         X RUN,RUNUUO            ;DEC'S SWAP UUO
708:         X SETUWP,SETUWP         ;SET USER WRITE PROTECT
709:         X REMAP,REMAP           ;REDO CORE MAP
710: 
711:         X GETSEG,CPOPJ          ;GET SEGMENT
712:         X GETTAB,CPOPJ          ;GETTAB ILLEGAL (ERROR RETURN) HERE.
713:         X <>,UUOERR             ;SPY ALSO ILLEGAL
714:         X SETNAM,SETNAM         ;SET JOB NAME
715:         X TMPCOR,TMPCOR         ;TEMPORARY FILES FOR RPG, ETC.
716:         X <>,UUOERR             ;FILL OUT THE TABLE
717: >
    UUOCON page# 0016 next  prev
719: ; THE FOLLOWING ARE STANFORD'S OWN PRIVATE CALLI'S
720: 
721: DEFINE STANFORD <
722:         X SPWBUT,SPCWAR         ;READ SWITCH REGISTER
723:         X CTLV,CTLV             ;PUT TTY IN NON-DUPLEX MODE.
724:         X <>,SETNAM             ;SET JOB NAME FOR SYSTAT (OBSOLETE)
725:         X SPCWGO,SPCWGO         ;ANOTHER SPACEWAR UUO
726:         X SWAP,SYSRJB           ;RUN A JOB
727:         X EIOTM,EIOTM           ;ENTER IOT USER MODE
728:         X LIOTM,LIOTM           ;LEAVE IOT USER MODE
729:         X PNAME,PNAME           ;GET A DEVICE'S PHYSICAL NAME
730:         X UFBGET,UFBGET         ;GET A FAST BAND - 400010
731:         X UFBGIV,UFBGIV         ;RELEASE A FAST BAND
732:         X UFBCLR,FBFLUSH        ;RELEASE ALL FAST BANDS
733:         X JBTSTS,USTAT          ;GET JOB STATUS WORD OF A JOB
734:         X TTYIOS,TTYIOS         ;GET A JOB'S TELETYPES STATUS WORD
735:         X CORE2,CORE2           ;FUNNY CORE UUO FOR HIGH SEGMENTS
736:         X ATTSEG,ATTSEG         ;ATTACH HIGH SEGMENT
737:         X DETSEG,DETSEG         ;DETACH HIGH SEGMENT
738:         X SETPRO,SETPRO         ;CHANGE PROTECTION OF HIGH SEGMENT - 400020
739:         X SEGNUM,SEGNUM         ;GET NUMBER OF HIGH SEGMENT
740:         X SEGSIZ,SEGSIZ 
741:         X LINKUP,LINKUP
742:         X DISMIS,DISMIS
743:         X INTENB,INTENB         ; ENABLE INTERRUPTS
744:         X INTORM,INTORM
745:         X INTACM,INTACM
746:         X INTENS,INTENS         ; 400030
747:         X INTIIP,INTIIP
748:         X INTIRQ,INTIRQ
749:         X INTGEN,INTGEN         ; GENERATE AN INTERRUPT
750:         X UWAIT,UWAIT
751:         X DEBREAK,DEBREAK
752:         X SETNM2,SETNM2         ; SET NAME OF UPPER, IF ANY
753:         X SEGNAM,SEGNAM         ; GET NAME OF UPPER, IF ANY
754:         X IWAIT,IWAIT           ; GO INTO A WAIT STATE, WAKE UP ON ANY INTERRUPT. - 400040
755:         X USKIP,USKIP           ; SKIP IF A UWAIT REALLY HAS TO WAIT.
756:         X BUFLEN,BUFLEN         ; RETURN BUFFER LENGTH FOR A DEVICE
757:         X NAMEIN,NAMEIN         ; SEE IF THIS JOB NAME EXISTS
758:         X SLEVEL,SETLVL         ; SET OR GET SERVICE LEVEL.
759:         X IENBW,IENBW           ; ENABLE INTERRUPTS AND IMMEDIATELY GO INTO WAIT STATE
760:         X RUNMSK,RUNMSK         ; SETS PROCESSOR RUN MASK
761:         X TTYMES,TTYMES         ; SEND A STRING TO A TTY
762:         X JOBRD,JOBRD           ; READ A BLOCK FROM A GUY'S CORE IMAGE - 400050
763:         X DEVUSE,DEVUSE         ; TO TELL HOW MANY PEOPLE ARE WAITING FOR A DEVICE
764:         X SETPR2,SETPR2         ; SET SECOND PROTECT-RELOCATE REGISTER!
765:         X GETPR2,PR2GET         ; GET LAST SETPR2 VALUE
766:         X RLEVEL,RLEVEL         ; GET CURRENT SERVICE LEVEL RESERVATION
767:         X UFBPHY,FBPHY          ; GET PHYSICAL BAND NUMBER
768:         X UFBSKP,FBSKP          ; SKIP IF NO TRANSFER IN PROGRESS
769:         X FBWAIT,FBWT           ; WAIT FOR TRANSFER TO FINISH
770:         X UFBERR,FBERR          ; SKIP IF NO ERRORS IN LAST TRANSFER. 400060
771:         X WAKEME,WAKEME         ; SET ALFRED. TIME TO INITIALIZE A JOB.
772:         X GETNAM,GETNAM         ;RETURN JOBNAME IN AC
773:         X SNEAKW,SNEAKW         ; PEEK AT NEXT TTY CHAR. AND WAIT FOR IT
774:         X SNEAKS,SNEAKS         ; PEEK AT NEXT TTY CHAR. AND SKIP IF ONE THERE
775:         X GDPTIM,GDPTIM         ; GET TIME CELLS
776:         X SETPRV,SETPRV         ; RESET JOBTPRV
777:         X DDCHAN,DDCHAN         ;GET/RELEASE DD CHANS ETC.
778:         X VDSMAP,VDSMAP         ;CHANGE VIDEO SWITCH MAPPING - 400070
779:         X DSKPPN,UDSKPPN        ;GET OR SET DISK ALIAS PPN
780:         X DSKTIM,DSKTIM         ;DATE & TIME A LA DSKSER
781:         X SETCRD,SETCRD         ;SET JOB CREATION DATE & TIME
782:         X CALLIT,CALLIT         ;TRANSLATE CALL TO CALLI OR VICE VERSA
783:         X XGPUUO,XGPUUO         ;FONT COMPILER & XGPSER COMMUNICATION.
784:         X LOCK,LOCK             ;LOCK A JOB IN CORE.
785:         X UNLOCK,UNLOCK         ;UNLOCK A JOB
786:         X DAYCNT,DAYCT          ;SYSTEM DATE TO DAY COUNT. - 400100
787:         X ACCTIM,ACCTIM         ;RETURN <DATE>,,<TIME IN SECS>
788:         X UNPURE,UNPURE         ;UNPURIFY UPPER SEGMENT
789:         X TMPCRD,TMPCRD         ;READ OTHER JOB'S TMPCOR
790:         X DEVNUM,DEVNUM         ;CONVERT LOGICAL DEV NAME OR CHANNEL # TO UNIT #
791:         X ACTCHR,ACTCHR         ;WAIT FOR ACTIVATION AND RETURN CHAR WHICH DUN IT
792:         X UUOSIM,UUOSIM         ;SET UP UUO SIMULATOR
793:         X PPSPY,PPSPY           ;LIKE PPINFO FOR ANOTHER JOB
794:         X ADSMAP,ADSMAP         ;SET/READ AUDIO SWITCH SELECTIONS -400110
795:         X BEEP,BEEP             ;BEEP A TTY'S CHANNEL
796:         X WHO,WHOUUO            ;READ SYSTEM OR USER WHO LINE
797:         X TTYJOB,TTYJNO         ;GET JOB # ON THIS TTY
798:         X (,UUOERR)             ;       "   IOPDL
799:         X GETPRV,GETPRV         ;GET PRIVILEGES BY JOB #
800:         X TTYSKP,TTYSKP         ;SKIP IF TTY INPUT UUO WON'T HANG
801:         X DIAL,DIAL             ;DIAL UUO
802: >
803: ;NOTE, USE UP THE UUOERR ENTRIES BEFORE MAKING NEW ONES
    UUOCON page# 0017 next  prev
805: ; MACROS TO DEFINE CALLI TABLES
806: 
807: DEFINE X! (A,B)
808: <
809:         <SIXBIT /A/>
810: >
811: UCLTAB:                ;POINTER TO HERE IN OUTER
812:         XLIST
813:         NAMES
814: XP UCLDLN,.-UCLTAB
815:         STANFORD
816:         LIST
817: XP UCLLEN,.-UCLTAB
818:         UUONAM          ;POINTER TO FIND REST OF UUO NAMES
819: 
820: DEFINE X!(A,B)
821: <IFE ZZ/2*2-ZZ,<DEFINE ZZZ<B>>
822: IFN ZZ/2*2-ZZ,<XWD ZZZ,B>
823: ZZ←←ZZ+1
824: >
825: 
826: ZZ←←0
827: 
828: UCLJMP:
829:         XLIST
830:         NAMES
831:         STANFORD
832:         LIST
833: 
834: IFN ZZ/2*2-ZZ,<XWD ZZZ,0>
    UUOCON page# 0018 next  prev
836: ;EXIT UUO ROUTINE
837: 
838: ;(1-14-72) EXIT UUO WITH AC FIELD ≠ 0 WILL STOP JOB,
839: ;TYPE CRLF DOT AND ALLOW USER TO TYPE CONTINUE
840: 
841: EXIT:   MOVE    TAC,JBTSTS(J)
842:         HRRE    TAC1,JBTLIN(J)
843:         JUMPL   TAC1,EXIT1      ;KILL DETACHED JOB THAT EXIT!
844:         TLNN    TAC,JLOG        ;LOGGED IN?
845:         JRST    EXIT1           ;FLUSH DETATCHED OR UNLOGGED IN JOBS
846:         JUMPN   UCHN,EXIT2      ;IS THIS CALLI N,12 WITH N≠0
847:         PUSHJ   P,IORELS        ;FLUSH USER'S IO
848:         PUSHJ   P,RESETB        ;RESET EVERYTHING ELSE
849:         PUSHJ   P,TTYFUW        ;FIND TTY FOR CURRENT JOB
850:                                 ;SET ITEM TO JOB NO.,DAT TO OUTPUT BYTE POINTER
851:                                 ;DEVDAT TO TTY DDB
852:         SETZM JOBOPC(PROG)      ;NO MORE OPC
853:         SETZM UUOPC(J)          ;OR USER PC (NOTE ESTOP CHANGED TO GO TO USRXIT)
854:         SETZM UUOOPC(J)         ;OR BACKUP USER PC
855:                                 ;NOTE ALL THIS MEANS THAT THE NEXT START, ETC.
856:                                 ;WILL LEAVE A 0 IN JOBOPC (HERE'S TO CLEAN RAID SCREENS)
857:         JSP TAC,PHOLD           ;MOVE "EXIT" TO OUTPUT BUFFER
858:                                 ;AND STOP JOB, AND START TTY
859:         ASCIZ /
860: EXIT/
861: 
862: EXIT1:  PUSHJ   P,IORELS        ;HERE TO KILL JOB.  FLUSH USER IO
863:         PUSHJ   P,KILSPW        ; ZERO SPACEWAR CELLS
864: IFN FTSWAP,<    JRST    JOBKL   >
865: IFE FTSWAP,<    JRST    ESTOP   >
866: 
867: 
868: EXIT2:  PUSHJ   P,KILSPW        ; ZERO SPACEWAR CELLS
869:         PUSHJ   P,TTYFUW        ;GET THE USER'S CONSOLE
870:         PUSHJ P,PRCRCC          ;TYPE CRLF ↑C CRLF .
871:         PUSHJ   P,TTYSTC        ;START THE TTY
872:         JRST    STOP1           ;COPIED (BLINDLY) FROM HALT, (LAME EXCUSE)
    UUOCON page# 0019 next  prev
874: ;SETPOV - SET PUSH DOWN OVERFLOW TRAP
875: ;CALL   MOVE AC,ADR. OF TRAP ON PD OVF
876: ;       CALL AC,[SIXBIT /SETPOV/]
877: 
878: 
879: SETPOV: MOVEM TAC,JOBAPR(JDAT)
880:         MOVEI TAC,1B19
881:         JRST APRENB             ;SET TRAP LOC.
882: 
    UUOCON page# 0020 next  prev
884: ;RESET UUO ROUTINE
885: 
886: RESET: PUSHJ P,RESETSEG
887: RESETUUO:
888:         SKIPE SPWUUF(PID)               ;AT SPACEWAR LEVEL?
889:         JRST SPWERR                     ;FLUSH THE BASTARD
890:         SKIPN INTACT(PID)
891:         JRST RESETA
892:         JSP TAC,UUOMES
893:         ASCIZ /RESET CALLED FROM I-LEVEL, OR SPACEWAR LEVEL
894: UUO/
895: 
896: RESETA: PUSHJ   P,IOKILL        ;RELEASE ALL DEVICES
897: RESETB: PUSHJ   P,INTKILL       ;CLEAR THE USER INTERRUPT SYSTEM (FLUSHES CLK REQS)
898:         PUSHJ   P,UNLOCK        ;UNLOCK HIM IN CORE.
899:         SKIPE   TAC,JBTPR2(J)   ;IS HE DOING PEEK-POKE?
900:         TRNE    TAC,2           ;DON'T CLEAR PSEUDO-UPPER
901:         JRST    NOPR2           ;NO
902:         SETZM   JBTPR2(J)       ;CLEAR IT
903:         PUSHJ   P,GETPR
904:         DATAO   APR,TAC         ;AND INDICATE IN PROT.,RELOC, REG.
905: NOPR2:                          ;AND RETURN TO USER
906:         MOVE    J,JOB(PID)
907:         SKIPE   AC1,JBTFS(J)    ;ANY FREE STORAGE?
908:         PUSHJ   P,FSGIVE        ;YES, RETURN IT
909:         SETZM   JBTFS(J)
910:         PUSHJ   P,KILSPW
911: IFN FTSWAP,<
912:         PUSHJ   P,FBFLUSH       ;RELEASE ALL HIS FAST BANDS
913: >
914:         SETZM   TAC
915:         PUSHJ   P,APRENB        ;KILL HIS APR INTERRUPTS
916:         SKIPE   AC1,JBTMAIL(J)  ;ANYTHING IN HIS MAILBOX ?
917:         PUSHJ   P,FSGIVE        ;YES. RETURN THE FREE STORAGE.
918:         SETZM   JBTMAIL(J)      ;EMPTY THE MAILBOX.
919:         PUSHJ   P,PTYCLR        ;FLUSH HIS PSEUDO TTY'S, IF ANY.
920:         MOVSI   TAC,(J)
921:         PUSHJ   P,DDAREL        ;FLUSH HIS DATA DISC CHANNELS
922:         PUSHJ   P,ADSRES        ;RESET AUDIO SWITCH MAP
923:         MOVE    AC1,JBTLIN(J)   ;PICK UP LINE CHARACTERISTICS
924:         CAME    AC1,[-1]        ;DETACHED?
925:         TLNN    AC1,DISLIN!DDDLIN       ;IF III OR DD, GO RESET THE DISPLAY
926:         POPJ    P,              ;NO, NO RESET OF SCREEN
927:         JRST    DPYRST          ;RESET HIS DPY, IF HE HAS ONE.
    UUOCON page# 0021 next  prev
929: ; ROUTINE TO RESET ONE'S UPPER SEGMENT
930: 
931: RESETSEG:
932:         PUSH    P,TAC
933:         PUSH    P,AC1
934:         PUSH    P,TAC1
935:         PUSH    P,DDB
936:         PUSHJ   P,FLUSHSEG      ; FLUSH HIS UPPER, IF ANY
937:         CAME    ITEM,JOB(PID)   ; IS THIS THE CURRENT JOB?
938:         JRST    RESTG1          ; NO, DON'T BOTHER TO RESET PR
939:         PUSHJ   P,GETPR         ; RESET HIS PROT-RELOC
940:         DATAO   APR,TAC
941: RESTG1: POP     P,DDB
942:         POP     P,TAC1
943:         POP     P,AC1
944:         POP     P,TAC
945:         POPJ    P,
    UUOCON page# 0022 next  prev
947: ;APRDKL  ROUTINE TO KILL ANY CLOCK INTERRUPT REQUESTS FOR JOB J
948: 
949: APRDKL: JUMPN PID,CPOPJ
950:         PUSH P,TAC1             ;SAVE THIS IN CASE SOMEONE DEPENDS ON IT
951:         CONI PI,TAC1            ;GET STATE OF PI SYSTEM
952:         ANDI TAC1,APROFF-1000   ;MASK FOR ONLY STATE OF APR CHANNEL
953:         CONO PI,APROFF          ;MAKE SURE CHANNEL IS OFF
954:         SKIPE TAC,APRLST
955: APRDK3: SKIPN AC1,(TAC)
956:         JRST APRDK1             ;APRLST EMPTY OR END OF LIST
957:         CAIN J,(AC1)
958:         JRST APRDK2             ;THIS IS OUR REQUEST
959:         ADDI TAC,2
960:         JRST APRDK3
961: 
962: APRDK2: PUSHJ P,APRDEL          ;DELETE REQUEST POINTED TO BY TAC
963:         JFCL
964: APRDK1: CONO PI,2000(TAC1)      ;TURN CHANNEL ON ONLY IF WE TURNED IT OFF.
965:         POP P,TAC1
966:         POPJ P,
    UUOCON page# 0023 next  prev
968: ;APRENB - ROUTINE TO SET UP APR FOR USER TRAPPING
969: ;CALL:  CALL AC,[SIXBIT /APRENB/]
970: ;WITH FOLLOWING APR CONSO FLAG BITS
971: ;TO INDICATE WHICH APR CONDITIONS SHOULD
972: ;TRAP TO USER WHEN TRAP OCCURS FROM USER MODE
973: 
974: ;1B18   ;CONS TRAP              ;JS
975: ;1B19   ;PUSHDOWN OVERFLOW
976: ;1B22   ;ILLEGAL MEMORY
977: ;1B23   ;NON-EXISTENT MEMORY
978: ;1B26   ;CLOCK
979: ;1B29   ;PC CHANGE FLAG (AR FOV ON THE PDP-10)
980: ;1B32   ;ARITH. OVERFLOW
981: 
982: CPUMSK←←1B18!1B19!1B22!1B23!1B29!1B32   ;MASK FOR CPU INT BITS (EXCEPT CLOCK)
983: 
984: APRENB:
985:         ANDI TAC,CPUMSK!1000            ;MASK OUT ILLEGAL BITS ;JS
986:         MOVEM TAC,JOBENB(JDAT)          ;SET RH TO CONSO BITS
987:         TDNE TAC,APRIN2(PID)
988:         JRST INTLOS
989:         IOR TAC,APRIN2(PID)             ;MAKE SURE WE INCLUDE OTHER MOORER INTS
990: APREN2: HRRM TAC,APRIN1(PID)            ;SET CONSO FLAGS IN APRSER ROUTINE WITH
991:                                         ;WITH FLAGS USER IS ENABLED FOR
992:         XORI TAC,1B29+1B32              ; COMPLEMENT PC CHNG AND AROV
993:         ADDI TAC,330                    ; DISABLE THE ENABLED ONES
994:         ANDI TAC,660
995:         CONO APR,APRCHN(TAC)            ;ENABLE OR DISABLE PC CHANGE AND OR OVF
996:         POPJ PDP,
    UUOCON page# 0024 next  prev
998: ;PJOB, DATE, DAYCNT, ACCTIM, DSKTIM, JOBTIM, MSTIME UUO'S
999: 
1000: JOBNO:  MOVE    TAC,ITEM                ;RETURN JOB NUMBER OF THIS JOB
1001:         JRST    STOTAC                  ;STORE IN USER AREA.
1002: 
1003: DATE:   MOVE    TAC,THSDAT              ;RETURN DATE TO USER
1004:         JRST    STOTAC
1005: 
1006: ;CONVERT SYSTEM FORMAT DATE TO NUMBER OF DAYS SINCE 1-JAN-64
1007: DAYCT:  JUMPG   TAC,.+2         ;ARGUMENT IN SYSTEM FORMAT TO DAY COUNT.
1008:         MOVE    TAC,THSDAT      ;ZERO OR NEGATIVE DATE GIVEN GETS TODAY'S DATE
1009:         PUSHJ   P,DAYCNT        ;THIS ROUTINE IS IN COMCON
1010:         JRST    STOTAC
1011: 
1012: ACCTIM: MOVE    TAC,TIMDAT      ;GET <DATE>,,<TIME IN SECS>
1013:         JRST    STOTAC          ;AND RETURN IT
1014: 
1015: DSKTIM: PUSHJ   P,DSKTM1        ;RETURN DATE & TIME IN DSKSER FORMAT
1016:         XCTR    XW,[MOVEM TAC1,(UUO)]
1017:         POPJ    P,
1018: 
1019: ;RETURN JOB RUNNING TIME IN MILLISECONDS
1020: JOBTIM: JUMPL   TAC,RTZERO      ;ILLEGAL JOB NUMBER
1021:         CAIL    TAC,JOBN        
1022:         JRST    RTZERO          ;ILLEGAL JOB NUMBER
1023:         JUMPG   TAC,.+2
1024:         MOVEI   TAC,(J)         ;ASSUME CURRENT JOB FOR ZERO ARGUMENT
1025:         MOVE    TAC,TTIME(TAC)  ;TOTAL JOB RUNNING TIME IN TICKS.
1026:         JRST    MST1            ;CONVERT TO MILLISECONDS AND RETURN
1027: 
1028: TIMER:  MOVE    TAC,TIME        ;RETURN TIME OF DAY IN JIFFIES
1029:         JRST    STOTAC
1030: 
1031: ;RETURN TIME OF DAY IN MILLISECONDS
1032: MSTIME: MOVE    TAC,TIME        ;GET TIME OF DAY
1033: MST1:   IMULI   TAC,=1000       ;CONVERT TIME FROM JIFFIES TO MILLISECONDS
1034:         IDIVI   TAC,JIFSEC      ;DIVIDE BY NO. OF JIFFIES PER SECOND
1035:         JRST    STOTAC
    UUOCON page# 0025 next  prev
1037: ;SLEEP  PUT JOB TO SLEEP FOR NSECONDS
1038: ;CALL   CALL AC,[SIXBIT /SLEEP/]
1039: 
1040: 
1041: SLEEP:
1042:         IMULI TAC,JIFSEC        ;MULTIPLY BY NO. OF JIFFIES PER SECOND
1043: SLEEPT:MOVSI TAC1,CLKR
1044:         TDNE TAC1,JBTSTS(ITEM)  ;DOES THIS JOB HAVE A CLOCK QUEUE
1045:                                 ;REQUEST IN CLOCK QUEUE?
1046:         JRST SETSLP             ;YES, DO NOT PUT ANOTHER ONE IN
1047:         TRNN TAC,7777           ;0 TIME?  ;JS
1048: SLEEP1: MOVEI TAC,1             ;YES. SLEEP 1 JIFFY
1049:         DPB ITEM,[POINT 6,TAC,23]
1050:         HRLI TAC,WAKE           ;ADR. IN RUNCSS WHEN JOB WAKES UP
1051:         CONO PI,PIOFF
1052:         IDPB TAC,CLOCK
1053:         CONO PI,PION
1054:         JRST SETSLP             ;SET JOB STATUS WORD SO JOB WILL NOT RUN
    UUOCON page# 0026 next  prev
1056: ;SWITCH RETURN DATA SWITCHES
1057: 
1058: SWITCH: DATAI   TAC                     ;READ SWITCHES, FALL INTO STOTAC
1059: 
1060: 
1061: ;ROUTINE TO STORE TAC IN USER AREA AS SPECIFIED BY UUO
1062: ;MUST BE CALLED FROM UUO LEVEL WITH PROG SETUP
1063: ;ALSO PROG IN INDEX FIELD OF UUO
1064: 
1065: STOTAC:
1066:         XCTR    XW,[MOVEM TAC,(UUO)]    ;STORE TAC INTO USER'S AC
1067:         POPJ    P,
    UUOCON page# 0027 next  prev
1069: ;DVCHR, DEVNUM
1070: 
1071: DVCHR:  PUSHJ   P,FNDDDB        ;SEARCH FOR DEVICE (OR CHANNEL)
1072:         TDZA    TAC,TAC         ;NOT A DEVICE, RETURN ZERO
1073:         SKIPA   TAC,DEVMOD(DDB) ;DEVICE FOUND,RETURN DEVMOD
1074:         JRST    STOTAC          ;RETURN ZERO, DEVICE NOT FOUND
1075:         TLNN    TAC,DVUDP
1076:         JRST    DVCHR2          ;EASY OUT UNLESS UDP
1077:         LDB     AC2,PUNIT       ;UDP, SCAN ENTIRE DDB LIST OF THIS UDP
1078:         MOVE    TAC1,DKDBML(AC2)
1079:         MOVE    AC1,DEVNAM(DDB)
1080: DVCHR0: HLRZ    TAC1,DEVSER(TAC1)
1081:         CAME    AC1,DEVNAM(TAC1)
1082:         JRST    DVCHR1          ;END OF DDBS FOR THIS DEVICE
1083:         IOR     TAC,DEVMOD(DDB) ;RETURN UNION OF ALL ASSCON AND ASSPRG BITS
1084:         JRST    DVCHR0
1085: 
1086: DVCHR1: SKIPL   TAC1,UDPOWN-1(AC2)
1087:         CAMN    TAC1,JOB(PID)
1088:         TLO     TAC,DVAVAL      ;AVAILABLE IF HIS OR PUBLIC
1089:         JRST    STOTAC
1090: 
1091: DVCHR2: LDB     TAC1,PJOBN      ;GET JOB NO.  USING DEVICE
1092:         CAME    TAC1,JOB(PID)   ;DOES CURRENT USER ALREADY HAVE IT?
1093:         TDNN    TAC,[XWD TTYATC,ASSCON+ASSPRG]  ;NO, IS IT ASSIGNED?
1094:         TLO     TAC,DVAVAL      ;NO, BUT HE CAN GET IT.
1095:         JRST    STOTAC
1096: 
1097: DEVNUM: PUSHJ   P,FNDDDB
1098:         POPJ P,                 ;NONE
1099:         LDB TAC,PUNIT           ;GET UNIT NUMBER
1100:         AOS (P)
1101:         JRST STOTAC
    UUOCON page# 0028 next  prev
1103: ;GETPPN -- DSKPPN
1104: 
1105: ;DSKPPN
1106: ;CALLING:
1107: ;       CALL AC,[SIXBIT/DSKPPN/]
1108: ;
1109: ;AC             MEANING
1110: ;0              RETURN CURRENT JOB'S DSKPPN
1111: ;1 TO JOBN-1    RETURN DSKPPN OF JOB IN AC
1112: ;-1             RESET DSKPPN OF CURRENT JOB
1113: ;ANYTHING ELSE  WILL TRY TO BE PPN TO SET DSKPPN TO
1114: ;               MUST HAVE NON-ZERO LEFT AND RIGHT HALVES
1115: 
1116: UDSKPPN:
1117: IFN FTDSKPPN,<
1118:         CAMN    TAC,[-1]        ;REQUESTING A RESET?
1119:         AOJA    TAC,RSTPPN      ;YES, SET TAC TO 0 AND STORE IT
1120:         TLNN    TAC,-1          ;IS IT PPN?
1121:         JRST    RTDSKPPN        ;NO, MAYBE JUST GETTING SOMEONES DSKPPN
1122:         TRNN    TAC,-1
1123:         HRR     TAC,PRJPRG(J)   ;COPY PRG FROM PRJPRG
1124: RSTPPN: CAMN    TAC,PRJPRG(J)
1125:         MOVEI   TAC,0           ;THIS IS REALLY A RESET
1126:         CAMN    TAC,MFDENT      ;SAME AS 1,1?
1127:         POPJ    P,              ;DISALLOW SOME FORMS OF LOSSAGE.
1128:         CAME    TAC,DSKPPN(J)
1129:         SETZM   JBTUFD(J)       ;CLEAR LOC OF UFD IF DEFAULT UFD IS CHANGING
1130:         MOVEM   TAC,DSKPPN(J)   ;SET NEW DISK ALIAS PPN
1131:         POPJ    P,
1132: 
1133: RTDSKPPN:
1134:         JUMPN   TAC,.+2
1135:         MOVE    TAC,J                   ;WANTS HIS OWN
1136:         MOVSI   TAC1,JNA
1137:         CAIGE   TAC,JOBN                ;LEGAL?
1138:         TDNN    TAC1,JBTSTS(TAC)        ;AND A REAL JOB?
1139:         JRST    RTZERO                  ;NO
1140:         SKIPN   TAC1,DSKPPN(TAC)        ;IF THIS IS 0
1141:         MOVE    TAC1,PRJPRG(TAC)        ;THEN THIS IS IT
1142: >;FTDSKPPN
1143: IFE FTDSKPPN,<
1144:         MOVE    TAC1,PRJPRG(J)
1145: >;FTDSKPPN
1146:         XCTR    XW,[MOVEM TAC1,(UUO)]   ;RETURN IT
1147:         POPJ    P,
1148: 
1149: RTZERO:MOVEI   TAC,0
1150:         JRST    STOTAC
1151: 
1152: ;RETURN PROJECT-PROGRAMMER NUMBER IN AC
1153: GETPPN:
1154: IFE FTLOGIN,<
1155:         JRST    RTZERO
1156: >
1157: IFN FTLOGIN,<   
1158:         MOVSI   TAC,JACCT               ;ACCOUNTING PROGRAM?
1159:         TDNE    TAC,JBTSTS(J)
1160:         JRST    GETPPL                  ;YES. GETPPN DOES DIFFERENT THING
1161:         MOVE    TAC,PRJPRG(J)
1162:         JRST    STOTAC
1163: 
1164: GETPPL: SETZM   JBTUFD(J)       ;ACCOUNTING: ANY OTHER USERS UNDER SAME PPN?
1165: IFN FTDSKPPN,<
1166:         SETZM   DSKPPN(J)       ;RESET DISK ALIAS PPN
1167: >
1168:         MOVE    TAC,DUMPPN      ;GET ALL POWERFULL PPN
1169:         EXCH    TAC,PRJPRG(J)   ;SET THIS JOB TO THAT PPN
1170:         MOVEI   TAC1,JOBN-1     ;LOOK THRU ALL THE WORLD
1171:         CAMN    TAC,PRJPRG(TAC1);SKIP IF NOT MATCHED
1172:         CAMN    J,TAC1          ;MATCH. SKIP IF MATCH DIFFERENT FROM JOB NUMBER
1173:         SOJG    TAC1,.-2        ;NO MATCH OR MATCHED SELF. LOOP
1174:         JUMPLE  TAC1,STOTAC     ;IF TAC1 = 0 THEN NO MATCH
1175:         AOS     (P)             ;MAKE IT SKIP RETURN
1176:         JRST    STOTAC          ;GO RETURN
    UUOCON page# 0029 next  prev
1178: ;SETNAM, SETCRD, SETDDT, GETNAM
1179: 
1180: SETNAM: MOVE J,JOB(PID)
1181:         MOVEM TAC,JOBNAM(J)     ;SET JOB NAME FOR SYSTAT
1182: IFN FTSTAT,<PUSHJ P,NAMSTT>
1183:         POPJ PDP,
1184: 
1185: ;SET CREATION DATE & PROT
1186: 
1187: SETCRD: TLZE TAC,400000         ;CLEAR & CHECK UNUSED BIT
1188:         JRST SETCD2             ;ANY OF THESE MEANS DO IT TO THE UPPER
1189: SETCD1: MOVEM TAC,JOBCRD(J)
1190:         TDNE TAC,[37,,-1]
1191:         POPJ P,
1192:         PUSHJ P,DSKTM1
1193:         IORM TAC1,JOBCRD(J)
1194:         POPJ P,
1195: 
1196: SETCD2: PUSH P,J        ;SAVE FOR ACCESS
1197:         LDB J,PSEGN
1198:         JUMPE J,TPOPJ   ;EASY IF NO UPPER
1199:         MOVE AC1,TAC    ;ELSE SAVE ARG
1200:         PUSHJ P,ACCESS  ;AND MAKE SURE THIS IS LEGAL
1201:         JRST TPOPJ
1202:         JRST TPOPJ
1203:         SUB P,[1,,1]    ;DON'T NEED THAT JOB # ANY MORE
1204:         MOVE TAC,AC1
1205:         JRST SETCD1
1206: 
1207: 
1208: SETDDT: MOVEM   TAC,USRDDT(PID) ;ROUTINE TO SET ONE'S DDT STARTING ADDRESS
1209:         POPJ    P,              ;RETURN TO USER
1210: 
1211: GETNAM: JUMPLE  TAC,GETNA1      ;GET JOBNAME GIVEN JOB NUMBER
1212:         CAIL    TAC,JOBN
1213: GETNA1: MOVE    TAC,J
1214:         MOVE    TAC,JOBNAM(TAC)
1215:         JRST    STOTAC
    UUOCON page# 0030 next  prev
1217: ;WAIT FOR IO TO BECOME INACTIVE ON CHANNEL AC
1218: 
1219: 
1220: WAIT:   JUMPE DEVDAT,IOIERR     ;CHANNEL ASSIGNED?
1221:         JRST WAIT1              ;WAIT TILL INACTIVE BEFORE
1222:                                 ;RETURNING TO USER.
1223: 
    UUOCON page# 0031 next  prev
1225: GETLN:  PUSHJ PDP,TTYFND        ;GET NAME OF TTY
1226:         MOVE TAC,DEVNAM(DEVDAT)
1227:         JRST STOTAC
    UUOCON page# 0032 next  prev
1229: ;CRKSER -- READ THE PETIT CROCK, J. SAUTER, REST OF PAGE.
1230: 
1231: ;FOR A DESCRIPTION OF THE ON-LINE CALENDAR CLOCK SEE
1232: ;SAILON MEMO NUMBER 9.
1233: 
1234: ;DATIME SKIPS RETURN IF CLOCK IS OK AND RETURNS IN DAT
1235: ;THE YEAR, MONTH, AND DAY IN STANDARD SYSTEM FORMAT.
1236: ;IN ITEM THE TIME TO THE NEAREST JIFFIE.
1237: 
1238: ;USED TO SKIP RETURN.
1239: 
1240: DATIME:
1241:         MOVEI TAC1,1000         ; TRY ONLY 1000 TIMES
1242: DAT2:   CONI PCLK,TEM           ;READ FAST PART.
1243:         DATAI PCLK,TAC          ;READ SLOW PART.
1244:         JUMPG TAC,DAT1          ;CLOCK IS VALID.
1245: DAT2A:  SOJG TAC1,DAT2          ;INVALID, RETRY.
1246:         POPJ PDP,               ;TOO MANY RETRIES, CONSIDER IT SICK.
1247: 
1248: DAT1:   SUBI TAC,5004           ;NORMALIZE CROCK DATA.
1249:         SUB TEM,[2020136700]    ;AND FAST PART.
1250:         LDB ITEM,[POINT 4,TEM,9]
1251:         LDB DAT,[POINT 4,TAC,35]
1252:         CAME DAT,ITEM           ;DID READINGS GIVE THE SAME MINUTE?
1253:         JRST DAT2A              ;NO. GO RETRY.
1254:         TLNE TAC,200000         ;YEAR INVALID?
1255:         POPJ PDP,               ;YES. CROCK SICK.
1256:         LDB ITEM,[POINT 4,TAC,19]       ;MONTH.
1257:         SUBI ITEM,4
1258:         CAIL ITEM,=12
1259:         POPJ PDP,
1260:         IMULI ITEM,=31
1261:         MOVEM ITEM,DAT
1262:         LDB ITEM,[POINT 5,TAC,24]
1263:         ADDM ITEM,DAT           ;ADD IN DAY.
    UUOCON page# 0033 next  prev
1265: ; FINISH READING PCROCK, CONVERT TO STANDARD FORM
1266: 
1267:         LDB TAC1,[POINT 4,TAC,11]
1268:         CAILE TAC1,=7           ;> 1979?
1269:         POPJ PDP,               ;YES.
1270:         IMULI TAC1,=10
1271:         LDB ITEM,[POINT 4,TAC,15]
1272:         CAILE ITEM,=9
1273:         POPJ PDP,               ;19WHAT?
1274:         ADD ITEM,TAC1
1275:         CAIG ITEM,=67           ;ITS AFTER 1-JAN-68.
1276:         POPJ PDP,
1277:         SUBI ITEM,=64           ;NORMALIZE TO 1964.
1278:         IMULI ITEM,=12*=31
1279:         ADDM ITEM,DAT           ;DAT IS NOW SET UP.
1280:         LDB TAC1,[POINT 5,TAC,29]       ;HOUR.
1281:         CAIL TAC1,=24
1282:         POPJ PDP,
1283:         MOVE ITEM,TAC1
1284:         IMULI ITEM,=60*=60*=60
1285:         ANDI TAC,77             ;MINUTES
1286:         CAIL TAC,=60
1287:         POPJ PDP,
1288:         IMULI TAC,=60*=60
1289:         ADD ITEM,TAC
1290:         LDB TAC,[POINT 6,TEM,15]        ;SECONDS.
1291:         CAIL TAC,=60
1292:         POPJ PDP,
1293:         IMULI TAC,=60
1294:         ADD ITEM,TAC            ;ADD INTO RESULT.
1295:         LDB TAC,[POINT 20,TEM,35]
1296:         CAML TAC,[=1000000]     ;CHECK MILLISECONDS.
1297:         POPJ PDP,
1298:         IDIVI TAC,<=1000000/JIFSEC>
1299:         ADD ITEM,TAC
1300:         CAML    DAT,THSDAT      ;DONT GO BACKWARDS
1301:         CAMGE   ITEM,TIME       ;DONT GO BACKWARDS
1302:         POPJ    P,              ;LOSER.
1303:         JRST CPOPJ1             ;RETURN + 1.
1304: 
    UUOCON page# 0034 next  prev
1306: ;LOGIN UUO.     FOR LOGIN CUSP ONLY.
1307: ;       CALL AC,['LOGIN ']
1308: ;       AC = -N,,LOC
1309: ;       LOC = LOCATION OF TABLE OF LENGTH N. TABLE HAS LOGIN GOODIES.
1310: ;(1-14-72 REWRITTEN BY REG)
1311: 
1312: IFN FTLOGIN,<                   ;ONLY FOR LOGIN SYSTEMS. (IFN INCLUDES SETPRV)
1313: LOGIN:  MOVSI   TAC1,JLOG       ;LOAD ONE BIT.
1314:         TDNE    TAC1,JBTSTS(J)  ;SKIP IF JOB NOT LOGGED IN
1315:         JRST    UUOERR          ;LOGGED IN ALREADY.
1316:         HLRO    AC1,TAC         ;GET -WORD COUNT
1317:         HRR     UUO,TAC         ;BASE OF DATA TABLE
1318:         MOVE    AC2,[XWD -LOGTOP,LOGTAB]        ;SET A DEPOSIT/CONTROL WORD
1319: LOGIN1: AOJG    AC1,LOGIN2      ;INCREMENT USER'S COUNT. SKIP IF EXHAUSTED
1320:         XCTR    XR,[SKIPA AC3,(UUO)]    ;GET DATA FROM USER AND SKIP
1321: LOGIN2: MOVEI   AC3,0           ;NO DATA FROM USER. USE ZERO
1322:         MOVEM   AC3,@(AC2)      ;STORE DATA IN JOB TABLE
1323:         ADDI    UUO,1           ;PUSH USERS POINTER
1324:         AOBJN   AC2,LOGIN1      ;LOOP UNTIL WE FILL MONITOR TABLES
1325:         IORM    TAC1,JBTSTS(J)  ;SET JLOG BIT IN JBTSTS
1326:         MOVSI   TAC1,JACCT      ;
1327:         ANDCAM  TAC1,JBTSTS(J)  ;CLEAR ACCOUNTING BIT
1328:         MOVE TAC1,JB2PRV(J)     ;INITIALIZE PRIVS TO PASSIVE PRIVS
1329:         MOVEM TAC1,JBTPRV(J)
1330: IFN FTDISK,<    SETZM   JBTUFD(J)  ;ZERO UFD POINTER FOR NEW PPN
1331: IFN FTDSKPPN,<  SETZM   DSKPPN(J)  ;INITIALIZE DISK ALIAS PPN
1332: >;FTDSKPPN
1333: >;FTDISK
1334: SETLOG:                        ;SET-UP USER TABLES FOR LOGIN AND OTHERS!
1335:         SKIPN   JBTJL(J)
1336:         PUSHJ   P,PRIBUF
1337: 
1338: ;SPREAD SERVICE LEVEL TO THIS NEW JOB
1339:         HRRZ    AC1,PRJPRG(J)   ;GET PROGRAMMER NAME
1340:         MOVN    TAC,SLNRES      ;LOAD -NUMBER OF RESERVATIONS
1341:         JUMPE   TAC,CPOPJ       ;NO RESERVATIONS.
1342:         HRLZ    TAC,TAC         ;-SLNRES,,0 IN TAC
1343: LOGIN4: HRRZ    TAC1,SLRES(TAC) ;PROG NAME WHO HAS A RESERVATION
1344:         CAME    TAC1,AC1        ;MATCH?
1345:         AOBJN   TAC,LOGIN4      ;NO MATCH: LOOP
1346:         JUMPGE  TAC,CPOPJ       ;NO MATCH ANYWHERE.
1347:         HLRZ    TAC,SLRES(TAC)  ;GET HIS RESERVATION AS A RH FRACTION
1348:         MOVEM   TAC,JBTGSL(J)   ;SET GUARANTEED SERVICE LEVEL
1349:         POPJ    P,              ;STOW IT.
1350: 
1351: ;TABLE OF TABLES SET BY LOGIN UUO. INCLUDE J AS INDEX REGISTER
1352: ;AND STORE @ THRU THIS TABLE.
1353: 
1354: LOGTAB: XWD J,PRJPRG    ;USER NAME 
1355:         XWD J,JB2PRV    ;JOB PASSIVE PRIVLEGE BITS
1356: LOGTOP←←.-LOGTAB        ;NO. OF TABLES TO BE SET
    UUOCON page# 0035 next  prev
1358: ; ROUTINE TO SET UP SCHEDULER DATA STRUCTURE FOR A JOB
1359: 
1360: PRIBUF:MOVEI AC3,JLLENGTH
1361:         PUSHJ P,FSGET
1362:         POPJ P,                 ;IF YOU LOSE, YOU LOSE
1363:         MOVEM AC1,JBTJL(ITEM)
1364:         SETZM JBTJLH(ITEM)
1365:         SETZM JBTGSL(J)
1366:         HRL AC2,AC1
1367:         HRRI AC2,1(AC1)
1368:         SETZM (AC1)
1369:         BLT AC2,JLLENGTH-1(AC1)
1370:         POPJ PDP,
    UUOCON page# 0036 next  prev
1372: ;SETPRV, GETPRV
1373: ;       SETPRV  SET JBTPRV      JOB PRIVILEGE BITS
1374: ;       CALL AC,['SETPRV']
1375: ; JBTPRV WILL BE SET TO CONTENTS OF AC IF 
1376: ; EITHER PRIPRV IS SET IN CURRENT JBTPRV OR JBTSTS INDICATES JACCT SET
1377: ; RETURN CONTENTS OF JBTPRV IN AC.
1378: ; IF AC REQUESTS FEWER PRIVILEGES THAN ARE NOW ALLOWED, THEN
1379: ; THE REQUEST WILL BE SUCESSFUL
1380: ; IF C(AC) = -1 THEN ONLY RETURN CURRENT CONTENTS OF JBTPRV
1381: 
1382: SETPRV: CAMN    TAC,[-1]        ;SKIP UNLESS SPECIAL CODE
1383:         JRST    STPRV1          ;JUST GIVE HIM THE CURRENT CONTENTS
1384:         MOVSI   TAC1,PRIPRV     ;THE PRIVILEGE PRIVILEGE BIT
1385:         MOVSI   AC1,JACCT       ;ACCOUNTING PROG, BIT
1386:         TDNN    AC1,JBTSTS(J)   ;SKIP IF JACCT SET
1387:         TDNE    TAC1,JB2PRV(J)  ;SKIP UNLESS PRIPRV SET
1388:         MOVEM   TAC,JBTPRV(J)   ;STORE NEW PRIV BITS IF JACCT ∨ PRIPRV
1389:         CAMN    TAC,JBTPRV(J)   ;ARE THESE THE SAME NOW?
1390:         POPJ    P,              ;YES RETURN QUICK
1391:         ANDM    TAC,JBTPRV(J)   ;TURN OFF THE ONES HE IS NOT REQUESTING
1392:         AND     TAC,JB2PRV(J)   ;LEAVE ON THE ONES HE CAN SET
1393:         IORM    TAC,JBTPRV(J)   ;AND SET THEM
1394: STPRV1: MOVSI   TAC,PRIPRV      ;RETURN PRIPRV FROM JB2PRV
1395:         AND     TAC,JB2PRV(J)
1396:         IOR     TAC,JBTPRV(J)   ;GET THE REST FROM JBTPRV
1397:         JRST    STOTAC          ;GIVE THEM BACK TO THE USER
1398: 
1399: ;GET PRIVILEGES FOR JOB
1400: ;CALLING SEQUENCE:
1401: ;       MOVE AC,[FUNC CODE,,JOB #]
1402: ;       GETPRV AC,
1403: ;       <ALWAYS RETURN HERE>
1404: ;CODE 0 ACTIVE PRIVILEGES
1405: ;CODE 1 PASSIVE PRIVILEGES
1406: 
1407: GETPRV: HLRZ AC1,TAC            ;GET FUNCTION CODE
1408:         CAIL AC1,MAXFNC         ;LEGAL FUNCTION CODE
1409:         JRST UUOERR             ;NO, FLUSH
1410:         HRRZ TAC,TAC            ;GET JUST JOB #
1411:         CAIGE TAC,JOBN          ;JOB # TO LARGE?
1412:         JUMPN TAC,.+2           ;OR 0?
1413:         MOVE TAC,J              ;YES, USE CURRENT JOB
1414:         XCT FNCTAB(AC1)         ;DO FUNCTION
1415:         JRST STOTAC             ;RETURN ANSWER
1416: 
1417: FNCTAB: MOVE TAC,JBTPRV(TAC)
1418:         MOVE TAC,JB2PRV(TAC)
1419: MAXFNC←←.-FNCTAB
1420: >
    UUOCON page# 0037 next  prev
1422: ;GET A PPN'S SERVICE LEVEL RESERVATION.
1423: ;CALLING
1424: ;       MOVE AC,[SIXBIT /PPN/]          ;ONLY THE PROG NAME IS USED
1425: ;       CALL AC,[SIXBIT /RLEVEL/]
1426: ;       RETURN HERE ALWAYS, AC = <SL RESERVATION IN %>,,PRG NAME,
1427: ;               IF RESERVATION ≠ 0, OTHERWISE AC = 0,,0.
1428: 
1429: 
1430: RLEVEL: HRRZ    AC1,TAC         ;GET PROGRAMMER NAME
1431:         MOVN    TAC,SLNRES      ;LOAD -NUMBER OF RESERVATIONS
1432:         JUMPE   TAC,RTZERO      ;NO RESERVATIONS: RETURN ZERO
1433:         HRLZ    TAC,TAC         ;-SLNRES,,0 IN TAC
1434: RLEV1:  HRRZ    AC2,SLRES(TAC)  ;PROG NAME WHO HAS A RESERVATION
1435:         CAME    AC2,AC1         ;MATCH?
1436:         AOBJN   TAC,RLEV1       ;NO MATCH: LOOP
1437:         JUMPGE  TAC,RTZERO      ;JUMP IF NO MATCH.
1438: RLEV2:  HLRZ    TAC,SLRES(TAC)  ;GET HIS RESERVATION AS A RH FRACTION
1439: GETLV1: IMULI   TAC,=100        ;MAKE IT LEFT HALF PERCENT
1440:         ADDI    TAC,400000      ;ROUND IT. (LIKE YOU DID IN CLKSER)
1441:         HRR     TAC,AC1         ;JOB NUMBER (OR PRG NAME) TO TAC
1442:         JRST    STOTAC          ;STOW IT.
1443: 
1444: 
1445: ;REG 12-5-72
1446: SPRSSL: SETZM   JBTGSL+1        ;SPREAD SERVICE LEVEL TO USERS WITH RESERVATIONS.
1447:         MOVE    TAC,[JBTGSL+1,,JBTGSL+2]        
1448:         BLT     TAC,JBTGSL+JOBN-1       ;FIRST ZERO ALL LEVELS.
1449:         SKIPLE  AC2,SLNRES      ;GET THE NUMBER OF RESERVATIONS
1450:         CAILE   AC2,SLRMAX      ;SKIP IF REASONABLE NUMBER.
1451:         POPJ    P,              ;RETURN QUICK IF NONE.
1452: SPRSS0: HRRZ    TAC1,SLRES-1(AC2)
1453:         MOVE    AC1,JOBNM1      ;LOOK THROUGH ALL THE JOBS
1454: SPRSS1: HRRZ    TAC,PRJPRG(AC1)
1455:         CAIE    TAC1,(TAC)
1456:         JRST    SPRSS2
1457:         HLRZ    TAC,SLRES-1(AC2)
1458:         MOVEM   TAC,JBTGSL(AC1)
1459: SPRSS2: SOJG    AC1,SPRSS1
1460:         SOJG    AC2,SPRSS0
1461:         POPJ    P,
1462: 
1463: ;SET BELOW IS DISABLED!
1464: ;GET OR SET A JOBS SERVICE LEVEL.
1465: ;CALLING
1466: ;       MOVE AC,[XWD %SLEVEL,JOB # ]
1467: ;       CALL AC,[SIXBIT/SLEVEL/]
1468: ;       RETURN HERE ALWAYS
1469: ;IF %SLEVEL<0 RETURN  CURRENT %SL,,JOB NUMBER
1470: ;OTHERWISE SET SLEVEL OF JOB TO %SLEVEL
1471: ; SET IS ALLOWED ONLY IF JOB NUMBER GIVEN IS 0 OR USER'S JOB #
1472: ; IF SET COMMAND FAILS, USER'S AC WILL BE SET TO 
1473: ; - % AVAILABLE 
1474: ;ALSO SET IT FOR HIS OTHER JOBS.
1475: ;IF JOB # = 0 USE THIS JOB
1476: ;IF JOB # = -1, AND SERVICE LEVEL MONITOR IS THE USER,
1477: ;       THEN RESET THE SL RESERVATION TABLE.
1478: 
1479: 
1480: SETLVL: HRRZ    AC1,TAC         ;GET JOB NUMBER
1481:         CAIL    AC1,JOBN        ;LEGAL JOB?
1482:         JRST    SETRES          ;NO. MAYBE SL MONITOR CHANGING RESERVATIONS
1483:         JUMPG   AC1,.+2         ;SKIP UNLESS ZERO
1484:         MOVE    AC1,J           ;ZERO MEANS THIS JOB.
1485: 
1486:         PUSH    P,AC1           ;THESE 5 INSTRUCTIONS: REG 12-5-72
1487:         PUSHJ   P,SPRSSL        ;SPREAD ALL SERVICE LEVELS
1488:         POP     P,AC1
1489:         HRRZ    TAC,JBTGSL(AC1)
1490:         JRST    GETLV1
1491:         
1492: ;;;     WE ARRIVE HERE IF A NEGATIVE JOB NUMBER IS SPECIFIED.
1493: ;;;     THIS IS ALWAYS ILLEGAL UNLESS THE JOB HAS THE SSL PRIVILEGE,
1494: ;;;     IN WHICH CASE THE CURRENT SLRESERVATION TABLE IS BEING RESET,
1495: ;;;     AND THE CALLING SEQUENCE WAS:
1496: ;;;     
1497: ;;;             MOVE AC,[XWD [ XWD <0,1OR2>,N
1498: ;;;                           <1ST TABLE ENTRY>
1499: ;;;                           <2ND TABLE ENTRY>
1500: ;;;                                 ...
1501: ;;;                           <NTH TABLE ENTRY>],-1]
1502: ;;;             CALL AC,[SIXBIT /SLEVEL/]
1503: ;;;             FAILURE RETURN (N TOO LARGE, TOTAL SL TOO MUCH, ETC.)
1504: ;;;             SUCCESS RETURN
1505: 
1506: SETRES: CAIE    AC1,-1
1507:         JRST    RTZERO
1508:         MOVE    TAC1,JBTPRV(J)  ;GET THE USER'S PRIV BITS
1509:         TLNN    TAC1,SSLPRV     ;SKIP IF HE HAS THE PRIVILEGE
1510:         JRST    RTZERO          ;RETURN ZERO.
1511: 
1512: ;;;     THIS IS THE CODE THAT READS A NEW SL RESERVATION TABLE FROM
1513: ;;;     GSLMON AND GIVES THE RESERVED AMOUNTS TO ANYBODY CURRENTLY
1514: ;;;     LOGGED IN, DECREASING THE SL OF SCROUNGERS IF NECESSARY.
1515: 
1516:         XCTR    XR,[HLRZ TAC1,(UUO)]    ;TAC1 ← USER REL. ADDR. OF TABLE INFO.
1517:         PUSHJ   P,RELOCA        ;CONVERT TAC1 TO ABSOLUTE ADDRESS
1518:         JRST    UADERR          ;  LOSER GOOFED
1519: 
1520:         HLRZ    AC2,(TAC1)      ;AC2 ← CORE COST OF SL = 0,1 OR 2
1521:         CAIL    AC2,3           ;IS 0 ≤ (TAC) ≤ 2  ?
1522:         MOVEI   AC2,1           ;NO, MAKE IT 1.
1523:         MOVEM   AC2,SLCOST      ;STORE IN SL DATA AREA
1524: 
1525:         HRRZ    TAC,(TAC1)      ;TAC ← (# OF RESERVATIONS)
1526:         CAILE   TAC,SLRMAX      ;TOO MANY RESERVATIONS?
1527:         JRST    SETAL0          ;YES, FAILURE EXIT
1528:         MOVSI   AC2,(TAC1)      ;SOURCE OF BLT.
1529:         HRRI    AC2,SLNRES      ;DESTINATION OF BLT
1530:         XCTR    XR,[HLRZ TAC1,(UUO)]    ;TAC1 ← USER REL. ADDR. OF TABLE INFO.
1531:         ADDI    TAC1,(TAC)      ;TAC1 ← USER REL. ADDR. OF TABLE'S END
1532:         PUSHJ   P,RELOCB        ;ADDRESS CHECK END OF SOURCE.
1533:         JRST    UADERR          ;  USER LOOSES
1534:         BLT     AC2,SLNRES(TAC) ;BLT NEW RES TABLE INTO SYSTEM
1535:         HRRZS   SLNRES          ;ZERO OUT THE 0,1,OR 2 IN LEFT HALF,
1536: 
1537:         MOVEI   TAC1,0          ;ADD UP NEW RESERVATIONS...
1538:         HLRZ    AC1,SLNRES(TAC)
1539:         ADD     TAC1,AC1
1540:         SOJG    TAC,.-2
1541: 
1542:         CAIG    TAC1,<XWD MAXLEV,0>/=100+SLRMAX ;TOO MUCH RESERVED SL?
1543: SETAL1: AOSA    (P)             ;NOT TOO MUCH. SET SKIP RETURN
1544: SETAL0: SETZM   SLNRES          ;TOO MUCH. CLEAR TABLE.
1545:         JRST    SPRSSL          ;SPREAD NEW TABLE
    UUOCON page# 0038 next  prev
1547: ;LOGOUT UUO
1548: 
1549: ;JS
1550: 
1551: IFN FTLOGIN,<
1552: LOGOUT: MOVSI TAC,JACCT         ; IS HE REALLY THE LOGOUT ROUTINE?
1553:         TDNN TAC,JBTSTS(ITEM)   ; SEE IF THE ACCOUNTING BIT IS ON
1554:         JRST UUOERR             ; NOT ON, HE IS A FAKE!
1555:         JRST JOBKL              ; ALL OK. LOG HIM OUT.
1556: >
1557: 
1558: IFE FTLOGIN,<
1559: 
1560: LOGIN:
1561: LOGOUT: JRST UUOERR
1562: >
1563:                         ;JS, REST OF PAGE
    UUOCON page# 0039 next  prev
1565: ; ROUTINE TO READ SPACEWAR BUTTONS
1566: 
1567: SPCWAR: CONI TV,TAC     ;READ SWITCH REGISTER
1568:         JRST STOTAC
    UUOCON page# 0040 next  prev
1570: ; ROUTINE TO COMPLEMENT STATE OF DUPLEXING
1571: ; DOES NOT AFFECT DUPLEXING OF ALT-MODE
1572: 
1573: CTLV:   JRST CTLV1      ;IN TTYSER. COMPLEMENT STATE OF DUPLEXING.
    UUOCON page# 0041 next  prev
1575: ; ROUTINE TO GET A WORD FROM MONITOR CORE
1576: 
1577: PEEK:   HRRZS TAC               ;ZERO LH OF TAC
1578:         CAML TAC,RMEMSIZ        ;OVER END OF CORE?
1579:         JRST RTZERO             ;YES. DONT LET HIM GET NON-EX MEM.
1580:         MOVE TAC,@TAC
1581:         JRST STOTAC
    UUOCON page# 0042 next  prev
1583: ; RUN A JOB UUO
1584: ; FORMAT AS FOLLOWS . . .
1585: ;       CALL AC,[SIXBIT /SWAP/]
1586: ;AC:    E,,F
1587: 
1588: ;E:     SIXBIT /DEVICE/
1589: ;       SIXBIT /FILENAME/
1590: ;       SIXBIT /EXTENSION/ + MODE BITS
1591: ;       XWD (CORESIZE - IN K),(STARTING ADDRESS)
1592: ;       SIXBIT /PROJ-PROG NUMBER/
1593: ; IF STARTING ADDRESS IS ZERO, C(JOBSA) WILL BE USED
1594: ; IF E=0, NO SAVE WILL BE DONE
1595: 
1596: ;F:     SIXBIT /DEVICE/
1597: ;       SIXBIT /FILENAME/
1598: ;       SIXBIT /EXTENSION/ + MODE BITS
1599: ;       XWD (CORESIZE - IN K),(STARTING ADDRESS INCREMENT)
1600: ;       SIXBIT /PROJ-PROG NUMBER/
1601: ; IF F=0, NO RUN WILL BE DONE. IF E=F=0, THE UUO IS A NO-OP
1602: ; MODE BIT 35 = DO NOT START JOB. JUST GET CORE IMAGE.
1603: ; MODE BIT 34 = MAKE STARTING ADDRESS ABSOLUTE, NOT AN INCREMENT
1604: ; MODE BIT 33 = LOGIN NEW JOB AND RUN THIS THERE!
1605: ; MODE BIT 32 = DON'T SET JLOG
1606: 
1607: 
1608: ;THIS VERSION IS INCLUDED FOR COMPATIBILITY WITH DEC
1609: RUNUUO: PUSHJ   P,SVUACS
1610:         HLRM    TAC,SAVSAI(J)           ;SET START INCREMENT
1611:         XCTR    XR,[HRRZ TAC1,5(TAC)]
1612:         MOVEM   TAC1,JOBCOR(JDAT)       ;SET CORE SIZE
1613:         HRROI   AC1,(TAC)               ;COPY PNTR WITH "RUN" FLAG
1614:         JRST    RUNUU2                  ;NOW ENTER SWAP UUO
    UUOCON page# 0043 next  prev
1616: ; SWAP UUO - CONTINUED . . .
1617: 
1618: SYSRJB: SKIPE   SPWUUF(PID)
1619:         JRST    SPWERR          ;FLUSH SPACEWAR
1620:         SKIPN   INTACT(PID)
1621:         JRST    SYSRJ2
1622:         JSP     TAC,UUOMES
1623:         ASCIZ   /SWAP CALLED FROM I-LEVEL
1624: UUO/
1625: SYSRJ2: XCTR    XR,[SKIPN AC1,(UCHN)]   ;PICK UP ADDRESSES OF TABLES, IF ANY
1626:         POPJ    P,                      ;NONE, NO-OP
1627:         MOVEM   AC1,JOBFDV(JDAT)        ;SAVE TABLE ADDRESS OF GET SIDE
1628:         MOVE    AC1,UUOPC(J)            ;SAVE RETURN ADDRESS
1629:         MOVEM   AC1,JOBOPC(JDAT)
1630:         PUSHJ   P,SVUACS                ;SAVE THE ACCUMULATORS IN FREE STORAGE
1631:         HLRZ    AC1,JOBFDV(JDAT)        ;PICK UP 'SAVE' TABLE ADDRESS
1632:         JUMPN   AC1,SYSSJB              ;IF NON-ZERO, DO A SAVE FIRST
1633: SYSRJ1: HRRZ    AC1,JOBFDV(JDAT)        ;GET 'RUN' TABLE ADDRESS BACK
1634:         JUMPE   AC1,SYSRXT              ;IF ZERO, EXIT GRACEFULLY
1635:         XCTR    XR,[MOVE TAC1,2(AC1)]   ;GET MODE BITS FIRST!
1636:         TRNE    TAC1,4                  ;AND TEST FOR RUN ELSEWHERE BIT
1637:         JRST    PHANTOM                 ;YES!
1638: RUNUU2: PUSHJ   P,SYSRS                 ;DO THE RUN COMMAND BIT
1639: PRUNJB: JSP     TAC1,SG1                ;ASSIGN DEVICE, DO LOOKUP, AND RESET PDL
1640:         JRST    NOFILE                  ;NO FILE?
1641:         PUSHJ   P,GETJB                 ;READ JOB IN
1642:         MOVSI   AC1,USRMOD              ;MAKE SURE HE GETS INTO USER MODE
1643:         HRR     AC1,JOBSA(JDAT)         ;PICK UP STARTING ADDRESS
1644:         MOVE    AC2,INCWRD(JDAT)        ;PICK UP OUR MODE BITS AGAIN
1645:         PUSH    P,AC1                   ;PUT THAT ADDRESS ON THE STACK
1646:         MOVE    J,JOB(PID)              ;PICK UP JOB NUMBER
1647:         TRNE    AC2,2                   ;IF BIT 34 ON, INHIBIT ADDING IN HIS STARTING ADDRESS
1648:         SKIPA   AC1,SAVSAI(J)           ;INSTEAD, PICK UP INCREMENT AND USE IT!
1649:         ADD     AC1,SAVSAI(J)           ;PICK UP STARTING ADDRESS INCREMENT
1650:         XCTR    XR,[SKIP (AC1)]         ;SEE IF ADDRESS IS IN BOUNDS
1651:         HRRM    AC1,(P)                 ;UPDATE STARTING ADDRESS
1652:         PUSH    P,AC2                   ;SAVE OUR RANDOM GOOD BITS
1653:         PUSHJ   P,RSUACS                ;RESTORE USER'S ACCUMULATORS
1654:         POP     P,AC2                   ;BRING BACK OUR R.G.B. WORD
1655:         POP     P,UUOPC(J)
1656:         TRNN    AC2,1                   ;IF MODE BIT 35 IS ON, DON'T START JOB
1657:         JRST    USRXIT
1658:         JRST    GETJ1
    UUOCON page# 0044 next  prev
1660: ; SWAP UUO - LOG IN NEW JOB AND RUN THIS ON IT - PHANTOM STARTUP
1661: 
1662: PHANTO: HLLZ    TAC,SAVSAI(J)   ;RESTORE ACS NOW, SINCE THEY ARE SAFE
1663:         HRRI    TAC,(PROG)      ;AND WE WILL GIVE THE TABLE TO THE NEW JOB
1664:         BLT     TAC,17(PROG)
1665:         XCTR    XR,[SKIPN TAC,5(AC1)]   ;PRJPRG
1666:         MOVE    TAC,PRJPRG(J)           ;USE CURRENT PPN
1667:         CAMN    TAC,PRJPRG(J)           ;IS HE DOING IT TO HIMSELF?
1668:         JRST    PHWIN                   ;YES
1669:         CAMN    TAC,SYSPPN              ;1,1
1670:         JRST    PHLOS1                  ;LOSE.
1671: PHWIN:  PUSH    P,J                     ;SAVE PRESENT JOB NUMBER
1672:         PUSH    P,PROG                  ;INIJOB CLOBBERS PROG!
1673:         PUSHJ   P,INIJOB                ;INITIALIZE A NEW JOB
1674:         JRST    PHLOSE                  ;NO JOBS TO BE HAD
1675:         JFCL    
1676:         POP     P,PROG                  ;RESTORE PROG
1677:         MOVSI   TAC,JNA
1678:         IORM    TAC,JBTSTS(J)
1679:         MOVEM   TAC1,JOBLOG(J)          ;SAVE MODE BITS AND EXTENSION
1680:         MOVSI   TAC,JLOG
1681:         TRNN    TAC1,10                 ;THIS BIT SAYS DON'T SET JLOG
1682:         IORM    TAC,JBTSTS(J)
1683:         SETZM   JBTUFD(J)               ;FLUSH THIS OR ELSE!
1684: IFN FTDSKPPN,<SETZM DSKPPN(J)           ;INITIALIZE DISK ALIAS PPN>
1685:         SETZM   JBTKCJ(J)               ;INITIALIZE KILO CORE SECONDS
1686:         XCTR    XR,[MOVE TAC1,(AC1)]    ;DEVICE
1687:         MOVEM   TAC1,JOBDEV(J)
1688:         XCTR    XR,[MOVE TAC1,1(AC1)]   ;FILENAME
1689:         MOVEM   TAC1,JOBNAM(J)
1690: IFN FTSTAT,<PUSHJ P,NAMSTT>
1691:         XCTR    XR,[MOVE TAC1,4(AC1)]   ;LOC OF FILE
1692:         MOVEM   TAC1,JOBPPN(J)
1693:         MOVE    TAC,(P)                 ;GET OUR J TEMPORARILY
1694:         XCTR    XR,[SKIPN TAC1,5(AC1)]  ;PPN
1695:         MOVE    TAC1,PRJPRG(TAC)        ;NONE, USE CURRENT
1696:         MOVEM   TAC1,PRJPRG(J)
1697:         CAME    TAC1,PRJPRG(TAC)        ;SAME AS CALLER?
1698:         TDZA    TAC1,TAC1               ;NO. ZERO CELL AND SKIP
1699:         MOVE    TAC1,JBTPRV(TAC)        ;SAME PPN. COPY OUR PRIVILEGE
1700:         MOVEM   TAC1,JBTPRV(J)          ;TO THE NEW GUY
1701:         MOVE    TAC1,PRJPRG(TAC)        ;GET OUR PPN
1702:         CAME    TAC1,PRJPRG(J)          ;SAME AS HIS?
1703:         TDZA    TAC1,TAC1               ;NO, NO PRIVELEGES
1704:         MOVE    TAC1,JB2PRV(TAC)        ;ALSO PASSIVE PRIVELEGES
1705:         MOVEM   TAC1,JB2PRV(J)
1706:         XCTR    XR,[MOVS TAC1,3(AC1)]   ;GET S.A.,,CORE SIZE
1707:         HRRZM   TAC1,JOBCRD(J)          ;PASS ON CORE SIZE
1708:         MOVE    TAC,(P)                 ;CALLERS JOB #
1709:         HLR     TAC1,SAVSAI(TAC)
1710:         MOVSM   TAC1,SAVSAI(J)          ;GIVE AC BLK AND S.A. TO NEW JOB
1711:         SETZM   SAVSAI(TAC)             ;NO LONGER BELONGS TO CALLER
1712:         ADDI    TAC1,(UCHN)
1713:         MOVEM   TAC,(TAC1)              ;CALLERS JOB # TO NEW JOB (IN SAME AC)
1714:         XCTR    XW,[MOVEM J,(UCHN)]     ;NEW JOB # TO CALLER
1715:         PUSHJ   P,DELBTT
1716:         POP     P,J
1717:         JRST    SYSRX2                  ;DON'T BOTHER LOOKING FOR ACS
1718: 
1719: PHLOSE: POP     P,PROG
1720:         POP     P,J
1721: PHLOS1: HLRZ    TAC,SAVSAI(J)           ;GET LOC OF SAVED AC'S
1722:         ADD     TAC,UCHN                ;LOC OF USERS AC
1723:         SETZM   (TAC)                   ;RETURN 0 TO INDICATE LOSSAGE
1724:         JRST    SYSRXT
    UUOCON page# 0045 next  prev
1726: ; ROUTINE TO DO THE GETTING OF A JOB FROM UUO LEVEL
1727: 
1728: SYSSJB: PUSHJ PDP,SYSRS         ; PICK UP ARGUEMENTS FROM USER
1729:         JSP TAC1,SG1            ; DO LOOKUP
1730:         JFCL
1731:         PUSH P,AC1
1732:         HRRZ AC1,SAVSAI(ITEM)   ; PICK UP STARTING ADDRESS
1733:         JUMPE AC1,SYSSJ1
1734:         XCTR    XR,[SKIP (AC1)]
1735:         TLO AC1,USRMOD
1736:         HRRM AC1,JOBSA(JDAT)
1737: SYSSJ1: POP P,AC1
1738:         PUSHJ PDP,SAVJB         ; DO ACTUAL SAVE
1739:         JRST SYSRJ1
1740: 
1741: SYSRXT: PUSHJ PDP,RSUACS        ; RESTORE ACCUMULATORS
1742: SYSRX2: MOVE TAC,JOBOPC(JDAT)   ; GET UUO RETURN ADDRESS
1743:         MOVEM TAC,UUOPC(ITEM)   ; AND RETURN TO IT!
1744:         JRST USRXIT             ; MAKE IT LOOK LIKE A UUO EXIT (WHICH IT IS)
1745: 
1746: ; ROUTINE TO PICK UP BITS OF USER'S GOODIE TABLE
1747: 
1748: SYSRS:  XCTR    XR,[MOVE TAC1,(AC1)]    ; PICK UP DEVICE NAME
1749:         MOVEM   TAC1,DEVWRD(JDAT)       ; STORE FOR SAVJOB
1750:         XCTR    XR,[MOVE TAC1,1(AC1)]   ;PICK UP FILE NAME
1751:         MOVEM   TAC1,FILNAM(JDAT)
1752:         MOVEM   TAC1,JOBNAM(J)          ;THIS IS NEW JOB NAME TOO
1753: IFN FTSTAT,<PUSHJ P,NAMSTT>
1754:         XCTR    XR,[HLRZ TAC1,2(AC1)]   ;PICK UP EXTENSION
1755:         JUMPN   TAC1,.+2                ;NOT SPECIFIED?
1756:         MOVEI   TAC1,'DMP'              ;HE REALLY WANTS .DMP
1757:         HRLZM   TAC1,FILEXT(JDAT)
1758:         XCTR    XR,[HRRZ AC2,2(AC1)]    ;PICK UP MODE BITS INTO AC2
1759:         MOVEM   AC2,INCWRD(JDAT)        ;AND SAVE THEM FOR US TO SEE LATER
1760:         XCTR    XR,[MOVE TAC1,4(AC1)]   ;AND PPN TOO
1761:         MOVEM   TAC1,JOBPPN(J)
1762:         JUMPL AC1,CPOPJ                 ;THAT'S ALL FOR RUN UUO
1763:         XCTR    XR,[HLRZ TAC1,3(AC1)]   ;PICK UP CORE SIZE
1764:         LSH     TAC1,12                 ;CONVERT TO RELOCATABLE ADDRESS
1765:         JUMPE   TAC1,.+2                ;UNLESS, OF COURSE, HE ASKED FOR NONE
1766:         SUBI    TAC1,1
1767:         MOVEM   TAC1,JOBCOR(JDAT)
1768:         XCTR    XR,[HRRZ AC1,3(AC1)]    ;PICK UP STARTING ADDRESS INCREMENT
1769:         HRRM    AC1,SAVSAI(J)           ;TUCK AWAY IN A CONVENIENT TABLE IN APRDAT
1770:         POPJ    P,
    UUOCON page# 0046 next  prev
1772: ; ROUTINE TO SAVE ACCUMULATORS OVER RUNJOB UUO
1773: 
1774: SVUACS: HLRZ    AC1,SAVSAI(J)   ; ANY FREE STORAGE HERE ALREADY?
1775:         JUMPE   AC1,SVUA2       ; NO, GET SOME
1776:         CAML    AC1,MEMSIZ      ; IS IT IN THE FREE STORAGE AREA?
1777:         CAML    AC1,RMEMSIZ     ; IT IS ABOVE USER CORE. IS IT IN REAL CORE?
1778:         JRST    .+2             ;THINK ABOUT IT SOME MORE, ANDY.
1779:         JRST    SVUA1           ;YES, USE IT
1780:         PUSHACS
1781:         PUSHJ   P,DISMES
1782:         ASCIZ   /GARBAGE IN SAVSAI LEFT HALF!
1783: /
1784:         POPACS
1785: SVUA2:  MOVEI AC3,20            ; GET A 20-WORD BLOCK OF FREE STORAGE
1786:         PUSHJ PDP,FSGET
1787:         HALT .+1                ; AT UUO LEVEL, SHOULDN'T HAPPEN
1788:         HRLM AC1,SAVSAI(ITEM)   ; SAVE THE POINTER
1789: SVUA1:  HRLI AC1,(PROG)         ; SET TO BLT IN USER'S ACS
1790:         HRR AC2,AC1
1791:         BLT AC1,17(AC2)
1792:         POPJ PDP,
1793: 
1794: RSUACS: HLLZ AC1,SAVSAI(ITEM)   ; PICK UP FREE STORAGE POINTER
1795:         JUMPE AC1,CPOPJ         ;NOBODY HOME
1796:         HRRI AC1,(PROG)
1797:         BLT AC1,17(PROG)
1798:         HLRZ AC1,SAVSAI(ITEM)
1799:         SETZM SAVSAI(ITEM)      ; ZERO OUT FS POINTER
1800:         JRST FSGIVE
    UUOCON page# 0047 next  prev
1802: ; EIOTM AND LIOTM UUO'S
1803: ; CAUSES A PROGRAM TO ENTER IOT USER MODE
1804: ; OR LEAVE IOT USER MODE
1805: 
1806: EIOTM:  MOVE    TAC,JBTPRV(J)
1807:         TLNN    TAC,LUPPRV
1808:         JRST    UUOERR
1809:         MOVSI   TAC,4000
1810:         ORM     TAC,UUOPC(ITEM)
1811:         POPJ    P,
1812: 
1813: LIOTM:  MOVSI   TAC,4000
1814:         ANDCAM  TAC,UUOPC(ITEM)
1815:         POPJ    P,
    UUOCON page# 0048 next  prev
1817: ; UUO TO GET THE PHYSICAL NAME OF A DEVICE
1818: ; PUT THE SIXBIT OF THE DEVICE LOGICAL NAME IN AN AC
1819: ; DO A 'CALL AC,[SIXBIT /PNAME/]
1820: ; AND THE ROUTINE SKIPS UPON SUCCESS (IE, IF DEVICE NAME EXISTS)
1821: ; AND RETURNS PHYSICAL NAME IN THAT AC
1822: 
1823: PNAME:  PUSHJ   P,FNDDDB        ; SEARCH FOR DEVICE NAME (OR CHANNEL #)
1824:         POPJ    P,              ; FAILURE
1825:         MOVE    TAC,DEVNAM(DDB) ; PICK UP PHYSICAL NAME
1826:         XCTR    XW,[MOVEM TAC,(UCHN)]
1827:         JRST    CPOPJ1
    UUOCON page# 0049 next  prev
1829: ; GET A JOB'S JOB STATUS WORD
1830: ; CALLING . . .
1831: ;       MOVE AC,<JOB NUMBER IN QUESTION>
1832: ;       CALL AC,[SIXBIT /JBTSTS/]
1833: ; RETURNS JOB STATUS WORD IN AC
1834: 
1835: USTAT:  JUMPG TAC,.+2           ; POSITIVE JOB NUMBER?
1836:         MOVE TAC,J              ; LESS OR EQUAL TO ZERO MEANS OWN JOB
1837:         CAIL TAC,JOBN           ; MUST BE LESS THAN MAXIMUM TOO
1838:         JRST UUOERR             ; OR ELSE, ERROR
1839:         MOVE TAC,JBTSTS(TAC)    ; GET STATUS WORD
1840:         JRST STOTAC             ; AND GIVE IT TO HIM
1841: 
    UUOCON page# 0050 next  prev
1843: ; GET A TELETYPE'S DEVIOS
1844: ; CALLING . . .
1845: ;       MOVE AC,<JOB NUMBER WHOSE TTY IOS YOU WANT>
1846: ;       CALL AC,[SIXBIT /TTYIOS/]
1847: 
1848: TTYIOS: JUMPL   TAC,TTYIO3              ;TRY NAME IF ILLEGAL NUMBER
1849:         CAIL    TAC,JOBN
1850:         JRST    TTYIO3                  ;ILLEGAL AS A JOB NUMBER, TRY AS A DEV NAME.
1851:         HLRZ    DDB,DEVLST
1852: TTYIO1: HLRZ    TAC1,DEVNAM(DDB)        ;IS THIS A TELETYPE?
1853:         CAIE    TAC1,'TTY'
1854:         JRST    TTYIO2                  ;NO. KEEP LOOKING.
1855:         LDB     TAC1,PJOBN              ;YES, DOES THE JOB NUMBER MATCH?
1856:         CAIE    TAC1,(TAC)
1857:         JRST    TTYIO2                  ;NO, SCAN SOME MORE
1858: TTYIO5: MOVE    TAC,DEVIOS(DDB)         ;YES, PICK UP HIS IOS
1859:         JRST    STOTAC                  ;AND GIVE IT TO HIM
1860: 
1861: TTYIO2: HLRZ    DDB,DEVSER(DDB)         ;PICK UP NEXT DEVICE DATA BLOCK ADDRESS
1862:         JUMPN   DDB,TTYIO1              ;AND GO BACK IF NOT END OF LIST
1863: TTYIO4: MOVNI   TAC,1                   ; IF END OF LIST, GIVE HIM A -1 TO CHEW ON
1864:         JRST    STOTAC
1865: 
1866: TTYIO3: PUSHJ   P,DEVSRC                ;TRY SEARCHING FOR THIS SIXBIT NAME.
1867:         JRST    TTYIO4                  ;LOSE.
1868:         JRST    TTYIO5                  ;WIN.
    UUOCON page# 0051 next  prev
1870: COMMENT $               WAKEME
1871: CALLED BY:
1872:         MOVE    AC,<ADDRESS OF 3 WORD BLOCK>
1873:         CALL    AC,['WAKEME'] OR CALLI AC,400061
1874:         <ERROR:  JOB NAMED WAS NOT IN BATMAN AND ROBIN, ELSE MAINTMODE SET>
1875: 
1876: 
1877: BLOCK CONTAINS
1878:         JOBNAME
1879:         PPN
1880:         DATA
1881: 
1882: IF JOBNAME AND PPN ARE FOUND IN BATMAN AND ROBIN THEN 
1883: SET ALFRED TO DATA.  DATA IS INTERPRETED AS FOLLOWS
1884:         <0 MEANS NEVER START THIS
1885:         =0 MEANS KEEP THIS JOB RUNNING
1886:         >0 DATA IS INTERPRETED AS 
1887:                 DATE,,TIME IN MINUTES 
1888:         WHEN TO START THIS AGAIN.
1889: 
1890: ALFRED IS ZEROED AT SYSINI, SO ALL JOBS NAMED IN BATMAN WILL
1891: BE STARTED AT RELOADS AND RESTARTS
1892: 
1893: $
1894: WAKEME:
1895: IFN FTBAT,<
1896:         SKIPE   MAINTMODE               ;SKIP IF NORMAL MODE
1897:         POPJ    P,                      ;ERROR RETURN IF MAINTMODE
1898:         XCTR    XR,[MOVE AC1,(UCHN)]    ;GET USER'S POINTER
1899:         XCTR    XR,[MOVE AC2,(AC1)]     ;GET JOBNAME
1900:         XCTR    XR,[MOVE AC3,1(AC1)]    ;GET PPN
1901:         MOVSI   TAC,-BATLEN             ;GET SIZE OF BATMAN
1902: WAKEM1: CAMN    AC2,BATMAN(TAC)         ;LOOK IN TABLE
1903:         CAME    AC3,ROBIN(TAC)          ;SAME AS TABLE?
1904:         JRST    WAKEM2                  ;NO
1905:         XCTR    XR,[SKIPGE AC3,2(AC1)]  ;GET DATA FOR ALFRED
1906:         JRST    WAKEM3                  ;RUN NEVER.
1907:         MOVE    AC1,TIME
1908:         IDIVI   AC1,=60*JIFSEC
1909:         HRL     AC1,THSDAT
1910:         CAMG    AC3,AC1                 ;SKIP IF RUN IN THE FUTURE
1911:         SETZM   BATYET                  ;MAKE CH7 LOOK NEXT TICK
1912: WAKEM3: MOVEM   AC3,ALFRED(TAC)         ;STUFF IT
1913:         JRST    CPOPJ1                  ;GIVE HIM SUCCESS RETURN
1914: 
1915: WAKEM2: AOBJN   TAC,WAKEM1              ;LOOK THRU TABLE
1916: >
1917:         POPJ    P,                      ;LOSE
1918: 
    UUOCON page# 0052 next  prev
1920: ;TRANSLATE SYSTEM CALL TO/FROM SIXBIT.
1921: 
1922: ;CALL:  MOVE AC,[SIXBIT OR NUMERIC UUO]
1923: ;       CALLIT AC,
1924: ;       RETURN WITH NUMERIC OR SIXBIT FORM (RESP.), 0 IF ERROR
1925: 
1926: ;IF AC12-16 ≠ 0,  ARG IS ASSUMED TO BE SIXBIT (ALL UUO MNEMONICS ARE > 2 CHARS)
1927: ; NUMERIC REPRESENTATION WILL BE RETURNED, OR 0 IF THE SPECIFIED UUO DOES
1928: ; NOT EXIST.  NOTE THAT CALLING THIS WITH 1- OR 2-CHARACTER NAMES MAY HAVE 
1929: ; STRANGE RESULTS.
1930: 
1931: ;IF AC12-17 = 0,  ARG IS ASSUMED TO BE A NUMERIC UUO OF SOME FORM.  THE AC AND
1932: ; ADDRESS FIELDS MUST BE 0 UNLESS RELEVANT FOR DECODING (I.E. ADR OF CALLI,
1933: ; AC OF TTYUUO, ETC.).  IF THE ARG IS A LEGAL UUO, ITS SIXBIT MNEMONIC WILL BE
1934: ; RETURNED, OTHERWISE 0.  IN THE EVENT OF AMBIGUITY, THE MORE SPECIFIC MNEMONIC
1935: ; WILL BE RETURNED (E.G. INCHRW RATHER THAN TTYUUO).
1936: 
1937: ;IF AC12-17 = 1, THE MNEMONIC FOR THE SPECIFIED MAJOR OPCODE WILL BE RETURNED.
1938: ; THE AC AND ADDRESS FIELDS MUST BE 0.  THIS PROVIDES A WAY TO GET AT MNEMONICS
1939: ; SUCH AS "TTYUUO".
1940: 
1941: CALLIT: TLNE TAC,36             ;IF ITS SIXBIT
1942:         JRST CALT0              ;    THEN GO LOOK IT UP
1943:         HLRZ TAC1,TAC
1944:         CAIE TAC1,(<CALLI>)
1945:         JUMPN TAC1,CALTU
1946:         ANDI TAC,-1
1947:         CAIGE TAC,UCLDLN        ;IF ITS A DEC CALLI
1948:         JRST CALT1              ;    THEN GET THE SIXBIT
1949:         TRZN TAC,400000         ;IF NOT A STANFORD CALLI
1950:         JRST RTZERO             ;    THEN RETURN 0
1951:         MOVEI TAC,UCLDLN(TAC)   ;GET ACTUAL POINTER
1952:         CAIL TAC,UCLLEN         ;IF ITS OFF THE END
1953:         JRST RTZERO             ;    THEN RETURN 0
1954: CALT1:  MOVE TAC,UCLTAB(TAC)    ;ELSE PICK UP SIXBIT
1955:         JRST STOTAC             ;THEN PUT IT IN AC AND RETURN
1956: 
1957: CALT0:  MOVSI TAC1,-UCLLEN
1958:         CAME TAC,UCLTAB(TAC1)   ;SEARCH CALLI SIXBIT TABLE
1959:         AOBJN TAC1,.-1
1960:         JUMPGE TAC1,CALT2       ;IF OFF THE END, TRY FOR OPCODES
1961:         MOVEI TAC,(TAC1)
1962:         CAIL TAC,UCLDLN         ;IF STANFORD CALL
1963:         MOVEI TAC,400000-UCLDLN(TAC)    ;THEN CONVERT
1964:         HRLI TAC,(<CALLI>)      ;MAKE IT A CALLI
1965:         JRST STOTAC             ; AND SHIP IT
    UUOCON page# 0053 next  prev
1967: CALTU:  ANDI TAC1,777000
1968:         CAIL TAC1,40000
1969:         CAIL TAC1,700000+IUUMAX*2000
1970:         JRST CALT0              ;OUTSIDE UUO RANGE - TRY AS SIXBIT
1971:         CAIL TAC1,100000
1972:         CAIL TAC1,700000
1973:         TRNE TAC,-1
1974:         JRST CALT0              ;IN BETWEEN RANGES OR RH NOT ZERO
1975:         TLZE TAC,1
1976:         JRST CALTU2             ;SPECIAL - FORCE MAJOR OPCODE NAME
1977:         MOVSI AC1,(TAC1)
1978:         MOVSI AC2,1000(TAC1)
1979:         MOVEI TAC1,UUONAM       ;HEADER FOR SECOND LEVEL TABLES
1980: CALTU1: HRRZ TAC1,-1(TAC1)
1981:         JUMPE TAC1,CALTU2       ;NO MORE - MUST BE PLAIN UUO
1982:         CAMG AC1,-1(TAC1)
1983:         CAMG AC2,-1(TAC1)
1984:         JRST CALTU1             ;NOT THIS ONE
1985:         HLLZ AC3,-1(TAC1)       ;GET OPCODE
1986:         CAMLE TAC,AC3
1987:         JRST RTZERO             ;ILLEGAL AC FIELD
1988:         ROT TAC,15
1989:         ANDI TAC,17             ;ISOLATE AC FIELD
1990:         ADD TAC,TAC1
1991:         MOVE TAC,(TAC)          ;GET SIXBIT
1992:         JRST STOTAC
1993: 
1994: CALTU2: TLNE TAC,(<17,>)
1995:         JRST RTZERO             ;AC FIELD MUST BE ZERO
1996:         ROT TAC,9               ;GET OPCODE
1997:         CAIL TAC,700
1998:         SKIPA TAC,UUONAM+40-700(TAC)
1999:         MOVE TAC,UUONAM-40(TAC)
2000:         JRST STOTAC
    UUOCON page# 0054 next  prev
2002: CALT2:  MOVSI TAC1,-IUUMAX*2-40 ;TOTAL # MAJOR OPCODES
2003:         CAME TAC,UUONAM(TAC1)
2004:         AOBJN TAC1,.-1
2005:         JUMPGE TAC1,CALT3       ;NOT FOUND - TRY SECOND LEVEL TABLES
2006:         MOVEI TAC,40(TAC1)      ;THIS WILL BE THE OPCODE
2007:         CAILE TAC,77
2008:         MOVEI TAC,700-40(TAC1)  ;UNLESS IT'S ONE OF THESE
2009:         ROT TAC,-9              ;PUT IT IN THE RIGHT PLACE
2010:         JRST STOTAC
2011: 
2012: CALT3:  MOVE DAT,[,UUONAM(TAC1)];INIT TABLE PNTR TO HDR, (TAC1) FOR @ BELOW
2013: CALT4:  HRR DAT,-1(DAT)         ;GET NEXT TABLE LOC
2014:         TRNN DAT,-1
2015:         JRST RTZERO             ;IF NO MORE JUST RET 0 FOR FAILURE
2016:         LDB TAC1,[270400,,-1(DAT)];GET MAX #
2017:         MOVNI TAC1,1(TAC1)      ;OFFSET BY 1 FOR COUNT
2018:         MOVSI TAC1,(TAC1)       ;MAKE AOBJN PNTR
2019:         CAME TAC,@DAT
2020:         AOBJN TAC1,.-1
2021:         JUMPGE TAC1,CALT4       ;TRY NEXT TABLE IF NOT FOUND
2022:         HLLZ TAC,-1(DAT)        ;FOUND - GET BASE OPCODE
2023:         DPB TAC1,[270400,,TAC]  ;SET CORRECT AC FIELD
2024:         JRST STOTAC
    UUOCON page# 0055 next  prev
2026: ;SETPR2, BEGIN SEGUUO
2027: SUBTTL  UUO'S FOR HIGH SEGMENTS ↔ BEGIN SEGUUO
2028: ;       SETPR2  UUO
2029: ;       MOVE AC,[XWD PROT.,RELOC]
2030: ;       CALL AC,['SETPR2']
2031: ;       <ERROR RETURN>
2032: ;       <SUCCESS RETURN>
2033: ;
2034: ;       RELOC IS ABSOLUTE ADDRESS YOU WISH AS YOUR BASE ADDRESS
2035: ;       IF THE LOW ORDER BIT IS ON THEN RELOC IS A RELATIVE ADDRESS
2036: ;       IN YOUR CORE IMAGE.
2037: ;       IF THE LOW ORDER BIT OF PROT IS ON THEN ACCESS IS WRITE PROTECTED
2038: ;       IF THE ACCESS IS ABSOLUTE AND YOU ARE NOT 1,2 THEN YOU ARE
2039: ;       AUTOMATICALLY WRITE PROTECTED.
2040: ;       BOTH PROT. AND RELOC. ARE TRUNCATED TO 1K BOUNDARIES WHEN LOADED
2041: ;       INTO THE PROT.-RELOC. REGISTER.
2042: ;       IN RELATIVE MODE PROT. IS ADJUSTED TO BE WITHIN YOUR CORE IMAGE.
2043: 
2044: 
2045: SETPR2:
2046:         TRNE TAC,1              ;IS THIS RELATIVE?
2047:         JRST PR2REL
2048:         MOVEI TAC1,(TAC)
2049:         ANDCMI TAC1,1777
2050:         CAML TAC1,RMEMSIZ       ;IS RELOC GREATER THAN MEMORY?
2051:         POPJ P,                 ;YES, LOSE
2052:         MOVE    TAC1,RMEMSIZ
2053:         CAILE   TAC1,-1         ;FULL HOUSE?
2054:         JRST    SETPRW          ;YES. LET HIM WRAP AROUND.
2055:         HLRZ TAC1,TAC
2056:         TRO TAC1,1777
2057:         HRRZ AC1,TAC
2058:         ANDCMI AC1,1777
2059:         ADDI TAC1,(AC1)
2060:         CAML TAC1,RMEMSIZ       ;IS RELOC+PROTECT GREATER THAN MEMORY?
2061:         POPJ P,                 ;YES
2062: SETPRW: MOVE TAC1,JBTPRV(J)     ;GET THIS GUY'S PRIV BITS
2063:         TLNN TAC1,ACWPRV        ;SKIP IF HE HAS ABS CORE WRITE PRIV
2064:         TLO TAC,1               ;NO, WRITE PROTECT AUTOMATICALLY
2065:         JRST PR2SET
    UUOCON page# 0056 next  prev
2067: ; HERE WE ADDRESS CHECK HIS PR REQUEST
2068: 
2069: PR2REL: HLRZ TAC1,JBTADR(J)     ;JOBS PROTECTION
2070:         HRRZ AC1,TAC            ;RELOC REQUESTED(RELATIVE TO CORE IMAGE).
2071:         ANDCMI AC1,1777
2072:         CAMLE AC1,TAC1          ;TOO HIGH?
2073:         POPJ P,                 ;LOSE
2074:         HLRZ AC1,TAC            ;PROT.
2075:         TRO AC1,1777
2076:         HRRZ AC2,TAC
2077:         ANDCMI AC2,1777
2078:         ADDI AC1,(AC2)          ;+RELOC
2079:         CAMLE AC1,TAC1          ;TOO BIG?
2080:         POPJ P,                 ;YES, LOSE
2081: PR2SET: PUSH P,TAC
2082:         PUSHJ P,KILSEG
2083:         POP P,TAC
2084:         AOS (P)
2085:         TRZ TAC,1776            ;MAKE IT PRETTY
2086:         TLO TAC,1776            ;       "
2087: STPR2: MOVEM TAC,JBTPR2(J)
2088:         JRST SEGXIT     ;SET UP PR AND JOBRL2
    UUOCON page# 0057 next  prev
2090: ;GETPR2
2091: ;CALLING SEQUENCE:
2092: ;       CALL AC,['GETPR2']
2093: ;       <ALWAYS RETURNS HERE>
2094: ;
2095: ;       AC NOW CONTAINS XWD PROT.,RELOC. 
2096: ;       LOW ORDER BIT OF PROT IS ON IF ACCESS IS WRITE PROTECTED.
2097: ;       LOW ORDER BIT OF RELOC IS ON IF RELATIVE MODE.
2098: 
2099: PR2GET:MOVE TAC,JBTPR2(J)
2100:         JRST STOTAC             ;GIVE HIM CURRENT VALUE
    UUOCON page# 0058 next  prev
2102: ; REMAP UUO . . .
2103: ; CALLING . . .
2104: ;       MOVEI AC,<HIGHEST ADDRESS IN LOW PART>
2105: ;       CALL AC,[SIXBIT /REMAP/]
2106: ;       <NO CAN DO>
2107: ; RETURNS JOB NUMBER OF SEGMENT IN ACCUMULATOR
2108: ; IF SIGN BIT IN AC IS ON, SETS SEGMENT AS WRITE-PROTECTED
2109: 
2110: REMAP:
2111:         PUSH P,TAC
2112:         PUSHJ P,LINKSEG
2113:         PUSHJ P,MAKESEG
2114:         LDB TAC1,PSEGN
2115:         JUMPE TAC1,TPOPJ
2116:         MOVE TAC,JBTSTS(TAC1)   ; IF WE GOT AN OLD ONE, MAKE SURE IT IS IN CORE
2117:         TLNE TAC,SWP!SHF
2118:         PUSHJ P,WSCHED          ; WAIT FOR IT TO GET IN
2119:         SKIPN JBTADR(TAC1)      ; DID WE GET A FRESH SEGMENT, OR LINK ON TO AN EXISTING ONE?
2120:         JRST REMAP1             ; WE GOT A NEW ONE
2121:         TLNE TAC,JSEG
2122:         JRST REMAP6
2123:         PUSHACS
2124:         PUSHJ P,DISDATE
2125:         PUSHJ P,DISERR
2126:         [ASCIZ/AT REMAP WITHOUT UPPER SEGMENT.
2127: J=/]
2128:         DISARG(DCP,<-20+J(P)>)
2129:         [ASCIZ/  TAC1=/]
2130:         DISARG(DCP,<-20+TAC1(P)>)
2131:         [ASCIZ/
2132: /]
2133:         -1
2134:         POPACS
2135:         JSP DAT,UERROR
    UUOCON page# 0059 next  prev
2137: ; REMAP - CHECK IF HE WANTS IT WRITE PROTECTED
2138: 
2139: REMAP6: TLNE TAC,JWP            ; IS IT WRITE PROTECTED?
2140:         SKIPL (P)               ; YES, IS THAT WHAT WE WANT?
2141:         CAIA
2142:         JRST REMAP5             ; YES
2143: 
2144:         TLNN TAC,JWP            ; IS IT UNPROTECTED?
2145:         SKIPGE (P)              ; YES, IS THAT WHAT WE WANT?
2146:         CAIA
2147:         JRST REMAP5
2148:         PUSHJ P,MAKESEG         ; NO, GET A NEW ONE
2149:         LDB TAC1,PSEGN          ;GET SEGMENT #
2150:         JUMPE TAC1,TPOPJ        ; LEAVE NOW IF WE DIDN'T GET ONE!
2151:         JRST REMAP1
2152: 
2153: REMAP5: POP P,TAC               ; GET NEW CORE ASSIGNMENT BACK
2154:         HRRZS TAC
2155:         ORI TAC,1777
2156:         PUSHJ P,CORUUO
2157:         CAIA
2158:         JRST REMAP7
2159:         PUSHACS
2160:         PUSHJ P,DISDATE
2161:         PUSHJ P,DISERR
2162:         [ASCIZ/ERROR RETURN FROM CORUUO AT REMAP5
2163: J=/]
2164:         DISARG(DCP,<-20+J(P)>)
2165:         -1
2166:         POPACS
2167:         JSP DAT,UERROR
2168: REMAP7: LDB TAC1,PSEGN
2169:         LDB UCHN,PUUOAC         ; CORUUO USES UCHN ITSELF!
2170:         JRST REMAP2
    UUOCON page# 0060 next  prev
2172: ; REMAP - IF HE IS NOT ON 1K BOUNDARY, ADJUST HIM
2173: 
2174: REMAP1: SETCM TAC,(P)           ; NOW WE DO THE SIMULATED UPWARDS BLT
2175:         TRNN TAC,1777           ; IS HE ALREADY AT A 1K BOUNDARY
2176:         JRST REMAP3             ; YES.
2177:         HRRZ TAC,USRREL(PID)    ; NO. GET AN EXTRA 1K TO BLT HIM UP INTO
2178:         ADDI TAC,2000
2179:         PUSHJ P,CORUUO
2180:         CAIA
2181:         JRST REMAP8
2182:         POP P,TAC
2183:         JRST KILSEG
2184: 
2185: REMAP8: HRRZ TAC,(P)
2186:         PUSHJ P,BLTUP           ;MOVE UP UPPER
2187:         LDB TAC1,PSEGN
2188:         LDB UCHN,PUUOAC         ; CORUUO USES UCHN ITSELF!
2189: REMAP3: POP P,TAC
2190:         MOVSI DAT,JWP
2191:         SKIPG TAC
2192:         ORM DAT,JBTSTS(TAC1)
2193:         HRRZS TAC
2194:         ORI TAC,1777
2195:         CAML TAC,USRREL(PID)
2196:         JRST KILSEG
2197:         HRLM TAC,JBTADR(J)
2198:         HRLM TAC,JOBADR
2199:         HRRM TAC,USRREL(PID)
2200:         HRRM TAC,JOBREL(JDAT)
2201: IFN FTSTAT,<
2202:         PUSH P,TAC
2203:         LSH TAC,-4
2204:         ANDI TAC,37700
2205:         ADDI TAC,CSZSTA+100
2206:         PUSHJ P,STAPUT
2207:         POP P,TAC
2208: >;FTSTAT
2209:         ADDI TAC,1(PROG)
2210:         HRRM TAC,JBTADR(TAC1)
2211: IFN FTSTAT,<
2212:         LSH TAC,-4
2213:         ANDI TAC,37700
2214:         TRO TAC,CPSSTA
2215:         PUSHJ P,STAPUT
2216: >;FTSTAT
2217:         HLRZ TAC,PROG
2218:         SUB TAC,USRREL(PID)
2219:         SUBI TAC,1
2220:         HRLM TAC,JBTADR(TAC1)
2221: IFN FTSTAT,<
2222:         LSH TAC,-4
2223:         ANDI TAC,37700
2224:         ADDI TAC,CSZSTA+100
2225:         PUSHJ P,STAPUT
2226: >;FTSTAT
2227:         HRL PROG,USRREL(PID)
2228:         PUSH    P,TAC1                  ;REG. FIX CORTAB AT REMAP TIME.
2229:         HRRZ    DSER,JBTADR(TAC1)       ;GET THE LOWEST ADDRESS IN UPPER
2230:         HLRZ    AC1,JBTADR(TAC1)        ;GET THE PROTECTION OF UPPER.
2231:         MOVEI   UCHN,0                  ;SET TO RELEASE CORE.
2232:         PUSHJ   P,CORSTG                ;RELEASE THIS FROM CORTAB
2233:         MOVE    UCHN,(P)                ;GET THE JOB NUMBER OF UPPER.
2234:         HLRZ    AC1,JBTADR(UCHN)        ;GET THE PROTECTION AGAIN
2235:         PUSHJ   P,CORSTG                ;CLAIM BLOCKS IN CORTAB
2236:         POP     P,TAC1
2237:         LDB     UCHN,PUUOAC             ;RESTORE UCHN
2238: REMAP2: XCTR    XW,[MOVEM TAC1,(UCHN)]
2239:         AOS     (P)
2240:         JRST    SEGXIT
    UUOCON page# 0061 next  prev
2242: ;BLTUP - FAST UPWARDS BLT
2243: ;TAKES SOURCE ADDRESS-1 IN TAC (RELATIVE)
2244: ;BLTS UP REST OF CORE IMAGE TO NEXT 1K BOUNDARY
2245: ;CAN ALSO ENTER AT FASBLT WITH TAC1=DEST-1 AND AC2=END DEST
2246: ;CLOBBERS TAC,TAC1,AC1,AC2,AC3
2247: ;THIS CODE IS MORE OR LESS COPIED FROM CORE ROUTINES IN 'E'
2248: 
2249: BLTUP: MOVEI TAC1,(TAC)
2250:         IORI TAC1,1777          ;DEST ADR
2251:         HLRZ AC2,PROG
2252: FASBLT: SUBI AC2,(TAC1)         ;LENGTH OF XFER
2253:         SUBI TAC1,(TAC)         ;DIST OF XFER
2254:         ADDI TAC,(PROG)         ;RELOCATE
2255:         CAILE AC2,(TAC1)        ;EASY (NO OVERLAP) IF LENGTH<DIST
2256:         JUMPGE TAC1,BLTUP1      ;NOW WE NEED TO WORRY
2257:         JUMPLE AC2,CPOPJ
2258:         MOVEI AC3,(TAC)
2259:         ADD AC3,TAC1            ;GET BACK DEST
2260:         HRLI AC3,(TAC)
2261:         ADDI AC2,(AC3)          ;END LOC+1
2262:         BLT AC3,-1(AC2)
2263:         POPJ P,
2264: 
2265: BLTUP1: CAILE TAC1,5            ;THIS IS BELIEVED TO BE THE ROUGH BREAK-EVEN POINT
2266:         JRST BLTUP2             ;BETWEEN THE TWO METHODS
2267:         JUMPE TAC1,CPOPJ
2268:         MOVSI AC1,(<POP TAC1,(TAC1)>)
2269:         HRRI AC1,(TAC1)
2270:         MOVSI TAC1,377777(AC3)  ;SET COUNT TO GO NEG AFTER APPROP # OF WDS
2271:         HRRI TAC1,(TAC)
2272:         ADDI TAC1,(AC3)         ;INITIAL FETCH ADR
2273:         MOVE AC2,[JUMPL TAC1,AC1]
2274:         MOVE AC3,[POPJ P,]      ;TO GET US BACK
2275:         JRST AC1                ;ROAR
    UUOCON page# 0062 next  prev
2277: ;HERE WE ITERATE ON BLTS, POSSIBLY STARTING WITH A SMALLER ONE
2278: 
2279: BLTUP2: PUSH P,AC2
2280:         IDIVI AC2,(TAC1)        ;REMAINDER WILL BWE SIZE OF SHORT ONE
2281:         MOVE AC2,(P)
2282:         ADDI AC2,1(TAC)         ;SOURCE END ADR+1
2283:         HRLI AC2,(AC2)
2284:         ADDI AC2,(TAC1)         ;SOURCE END+1,,DEST END+1
2285:         JUMPE AC3,BLTUP3        ;SKIP INITIAL STEP IF 0 REMAINDER
2286:         MOVSI AC1,(<BLT AC3,(AC2)>)
2287:         HRRI AC1,-1(AC3)
2288:         HRLI AC3,(AC3)
2289:         SUBB AC2,AC3            ;BACK UP & DUPLICATE POINTER
2290:         XCT AC1
2291: BLTUP3: HRLI TAC1,(<BLT AC3,(AC2)>)     ;CREATE BLT WITH APPROP OFFSET
2292:         MOVEM TAC1,(P)
2293:         SOS (P)
2294:         HRLI TAC1,(TAC1)        ;DIST,,DIST
2295:         MOVEI AC1,1(TAC)
2296:         ADDI AC1,(TAC1)         ;DEST ADR
2297: BLTUP4: SUB AC2,TAC1            ;BACKUP PNTR OVER NEXT BLT
2298:         MOVE AC3,AC2            ;DUPLICATE FOR BLT
2299:         XCT (P)                 ;DO BLT
2300:         CAIGE AC1,(AC2)         ;DOWN TO STARTING DEST ADR YET?
2301:         JRST BLTUP4             ;NO - DO SOME MORE
2302:         SUB P,[1,,1]
2303:         POPJ P,
    UUOCON page# 0063 next  prev
2305: ; UUO TO SET OR CLEAR USER WRITE-PROTECT BIT
2306: ; CALLING . . .
2307: ;       MOVE AC,<0 FOR CLEAR, ≠0 FOR SET>
2308: ;       CALL AC,[SIXBIT /SETUWP/]
2309: ;       <NO CAN DO>
2310: 
2311: SETUWP:
2312:         PUSH P,J
2313:         PUSH P,TAC
2314:         LDB J,PSEGN
2315:         JUMPN J,SETUW1
2316:         POP P,TAC
2317:         POP P,J
2318:         JRST SEGXIT
2319: 
2320: SETUW1: PUSHJ P,ACCESS
2321:         JFCL
2322:         JRST SETUW2
2323:         POP P,TAC1
2324:         MOVSI TAC,JWP
2325:         JUMPE TAC1,.+2
2326:         IORB TAC,JBTSTS(J)
2327:         JUMPN TAC1,.+2
2328:         ANDCAB TAC,JBTSTS(J)
2329:         HLRZ TAC1,JBTADR(J)     ;FOR CORE2X
2330:         JRST CORE2X     ;UPDATE EVERYONE'S JOBRL2 WP FLAG
2331: 
2332: SETUW2: POP P,TAC
2333:         POP P,J         ; FORGET IMMEDIATELY IF READ-ONLY ACCESS
2334:         SKIPE TAC
2335:         JRST CPOPJ1
2336:         POPJ P,
    UUOCON page# 0064 next  prev
2338: ;UNPURE - MAKE A WRITEABLE COPY OF WRITE-PROTECTED UPPER, IF NECESSARY
2339: ;SKIPS IF SUCCESSFUL, IF ALREADY WRITEABLE, OR IF NO UPPER
2340: ;NO-SKIP MEANS COPY COULDN'T BE CREATED (JOB SLOTS OR CORE NEEDED)
2341: 
2342: UNPURE:
2343:         LDB AC1,PSEGN
2344:         JUMPE AC1,UNPNON        ;NONE AT ALL, CHECK PR2
2345:         MOVE TAC,JBTSTS(AC1)
2346:         TLZN TAC,JWP
2347:         JRST CPOPJ1             ;NOT WRITE-PROTECTED
2348:         MOVE TAC1,NJOBS(AC1)
2349:         SOJE TAC1,UNPUR3        ;SEE IF WE HAVE SOLE ACCESS
2350:         PUSHJ P,ANYACT          ;NO - WAIT FOR I/O & SPW
2351:         PUSHJ P,IOWAIT
2352:         LDB AC1,PSEGN
2353:         PUSHJ P,ESTSEG          ;TRY TO CREATE FRESH UPPER
2354:         JRST SPWCNT             ;NO JOBS
2355:         MOVSI TAC,SWP
2356:         IORM TAC,JBTSTS(J)      ;PRETEND SWAPPED OUT SO CORGET WON'T CALL XPAND
2357:         MOVEI PROG,             ;NO CORE YET
2358:         HLRZ TAC,JBTADR(AC1)    ;HOW MUCH WE WOULD LIKE
2359:         PUSHJ P,CORGET          ;TRY TO GET IT
2360:         JRST UNPNC              ;NO CAN DO - MUST HACK VIA SWAPPER
2361:         MOVSI TAC,SWP
2362:         ANDCAM TAC,JBTSTS(J)    ;FIX THIS BEFORE WE FORGET
2363:         MOVE AC1,JOB
2364:         LDB AC1,[600,,JBTSTS(AC1)]      ;GET CURRENT SEGMENT AGAIN
2365:         HLRZ TAC,PROG
2366:         ADDI TAC,(PROG)
2367:         HRL PROG,JBTADR(AC1)
2368:         BLT PROG,(TAC)          ;COPY DATA TO NEW SEGMENT
2369: UNPURX: PUSH P,J
2370:         MOVE J,JOB
2371:         MOVE PROG,JBTADR(J)
2372:         PUSHJ P,SPWCNT          ;IN CASE SPW STOPPED
2373:         PUSH P,AC1
2374:         PUSHJ P,KILSEG          ;GET RID OF OLD SEGMENT
2375:         POP P,J
2376:         POP P,TAC
2377:         PUSHJ P,MAKSE2          ;COPY PARAMETERS FROM OLD
2378:         MOVE J,JOB(PID)
2379:         DPB TAC,PSEGN           ;THIS IS NOW OUR SEGMENT
2380: IFN FTSTAT,<
2381:         PUSHJ P,SEGSTT
2382:         LDB TAC,PSEGN
2383: >;FTSTAT
2384: UNPUR2: MOVEI AC1,(TAC)
2385: UNPU21: MOVE TAC,JOBNAM(AC1)    ;MUNG JOBNAM SO THE OLD ONE IS STILL UNIQUE
2386:         LSH TAC,-6              ;CLEVERLY PRESERVING THE INFO FOR HUMANS
2387:         MOVEM TAC,JOBNAM(AC1)
2388:         MOVEI TAC,400(J)        ;400 BIT WILL FEND OFF ACCESS
2389:         DPB TAC,[331100,,JOBCRD(AC1)]   ;CLEAR PROTECTION
2390:         JRST SEGXT1             ;RETURN SUCCESSFULLY
2391: 
2392: UNPUR3: MOVEM TAC,JBTSTS(AC1)   ;OURS ALONE - JUST UNPROTECT IT
2393:         JRST UNPU21
2394: 
2395: UNPNON: MOVSI TAC,1
2396:         TSNE TAC,JBTPR2(J)      ;IF HE HAS RELATIVE PR2
2397:         ANDCAM TAC,JBTPR2(J)    ;THEN UNPROTECT IT
2398:         JRST SEGXT1             ;NOW UPDATE PR & JOBHRL & SKIP RETURN
    UUOCON page# 0065 next  prev
2400: ;UNPURE CONTINUED:
2401: ;HERE WE COULDN'T GET CORE IMMEDIATELY FOR THE NEW SEGMENT, SO WE'LL GET
2402: ;THE SWAPPER TO DO THE WORK
2403: 
2404: ;FIRST WE MAKE SURE THE CORE AND DISK COPIES OF OUR PRESENT UPPER AGREE.
2405: ;IF NOT, WE WAIT WHILE TRYING TO FORCE A SWAP
2406: UNPNC:  MOVSI TAC,SWP
2407:         ANDCAM TAC,JBTSTS(J)    ;FIRST PUT THIS BACK
2408:         MOVE AC1,JOB(PID)
2409:         LDB AC1,[600,,JBTSTS(AC1)]      ;GET BACK OLD UPPER #
2410:         HLRZ TAC,JBTSWP(AC1)
2411:         SKIPN STIME(AC1)
2412:         JUMPN TAC,UNPNC4        ;AH, UPPER HAS BEEN SWAPPED AND NOT CHANGED
2413:         MOVSI TAC,JSEG!JNA!JLOG
2414:         ANDCAM TAC,JBTSTS(J)    ;MUST WAIT - MEANWHILE GIVE BACK JOB SLOT
2415:         SETZM PRJPRG(J)
2416:         MOVEI TAC,NULQ
2417:         MOVNM TAC,JOBQUE(J)
2418:         PUSHJ P,REQUE
2419:         MOVE J,JOB(PID)         ;NOW BE OURSELVES, WAITING FOR OUR UPPER TO GET SWAPPED
2420: UNPNC1: LDB AC1,PSEGN
2421:         HLRZ TAC,JBTSWP(AC1)
2422:         SKIPN STIME(AC1)
2423:         JUMPN TAC,UNPNC3        ;NOW WE'RE ALMOST READY
2424:         SKIPN FINISH            ;NOT YET - SEE IF WE CAN DIDDLE THE SWAPPER
2425:         SKIPE FORCE
2426:         JRST UNPNC2             ;NO - WAIT A LITTLE
2427:         MOVEM AC1,FORCE         ;YES - THIS OUGHT TO GET IT OUT THERE
2428:         SETZM SWPCNT
2429: UNPNC2: PUSHJ P,WSCHED          ;WASTE A LITTLE TIME
2430:         JRST UNPNC1             ;AND TRY AGAIN
2431: 
2432: ;SWAPPING IS NOW COMPLETE. NOW TRY TO GET BACK JOB SLOT.
2433: UNPNC3: PUSHJ P,ESTSEG
2434:         JRST SPWCNT             ;AFTER ALL THAT WORK ...
2435: 
2436: ;THE CORE AND DISK COPIES OF THE UPPER NOW AGREE. WE WILL STEAL THE CORE COPY,
2437: ;LEAVING THE OTHER LOSERS TO FIGHT OVER GETTING THE DISK ONE SWAPPED BACK IN.
2438: UNPNC4: MOVSI TAC,SWP
2439:         IORM TAC,JBTSTS(AC1)    ;SEE US SCREW ALL THE OTHER POOR LOSERS
2440:         MOVEI DSER,
2441:         EXCH DSER,JBTADR(AC1)   ;THE OLD UPPER IS NOW OFFICIALLY SWAPPED OUT!
2442:         MOVEM DSER,JBTADR(J)    ;GEE, WHAT AN EASY CORE UUO
2443:         PUSH P,AC1
2444:         HLRZ AC1,DSER           ;NOW ALL WE HAVE TO DO IS FIX CORTAB
2445:         ANDI DSER,-1
2446:         MOVEI UCHN,
2447:         PUSHJ P,CORSTG          ;OUT WITH THE OLD JOB
2448:         MOVEI UCHN,(J)
2449:         HLRZ AC1,JBTADR(J)
2450:         PUSHJ P,CORSTG          ;AND IN WITH THE GOOD
2451:         POP P,AC1               ;RESTORE JOB NUMBER OF OLD SEG TO COPY DATA
2452:         JRST UNPURX             ;DO THE FINAL CLEANUP AND LEAVE
    UUOCON page# 0066 next  prev
2454: ; CORE UUO FOR HIGH SEGMENTS
2455: ; CALLING . . .
2456: ;       MOVE AC,<HIGHEST REL. ADR. IN UPPER, INCLUDING 0>
2457: ;       CALL AC,[SIXBIT /CORE2/]
2458: ;       <ERROR RETURN>
2459: 
2460: CORE2:
2461:         TRNE    TAC,377777              ;IS HE REQUESTING ANY CORE AT ALL?
2462:         JRST    CORE2A                  ;YES.
2463:         AOS     (P)                     ;NO. GIVE HIM THE SUCCESS RETURN
2464:         JRST    KILSEG                  ;AND KILL THE SEGMENT
2465: 
2466: CORE2A: ORI     TAC,1777                ;ROUND UP TO NORMAL BOUNDARY
2467:         ANDI    TAC,377777              ;ZERO SOME BITS.
2468:         PUSH    P,J
2469:         LDB     J,PSEGN
2470:         JUMPN   J,CORE2B                ;JUMP IF WE HAVE A SEGMENT ALREADY.
2471:         POP     P,J                     ;HERE WE HAVE TO MAKE A NEW SEGMENT
2472:         PUSH    P,TAC
2473:         PUSHJ   P,MAKESEG
2474:         POP     P,TAC
2475:         LDB     TAC1,PSEGN
2476:         JUMPE   TAC1,SEGXIT             ;WE LOSE SOMEHOW - NO SEGMENT AVAILABLE.
2477:         PUSH    P,J
2478:         LDB     J,PSEGN
2479:         JRST    CORE2N                  ;AVOID ACCESS CHECK WHEN MAKING A NEW ONE
2480: 
2481: CORE2B: PUSH    P,TAC
2482:         PUSH    P,-1(P)                 ;PUT JOB NUMBER ON TOP OF STACK
2483:         PUSHJ   P,ACCESS
2484:         JFCL                            ;LOSE?
2485:         JRST    CORE2C                  ;LOSE?
2486:         POP     P,(P)
2487:         POP     P,TAC
2488: CORE2N: MOVE    PROG,JBTADR(J)          ;J HAS NUMBER OF THE UPPER.
2489:         PUSHJ   P,CORUUO
2490:         JRST    CORE2D
2491:         PUSH    P,PROG
2492:         MOVE TAC,JBTSTS(J)
2493:         TLNN TAC,SWP!SHF        ;SWAPPED OR MOVING?
2494:         SKIPE XJOB(J)           ;OR TRYING TO GROW?
2495:         PUSHJ P,WSCHED          ;YES, WAIT FOR IT
2496:         POP P,PROG              ;GET THIS BACK
2497:         HLRZ TAC1,PROG
2498: CORE2X: TLNE TAC,JWP
2499:         TLO TAC1,400000         ;TELL LOSERS ABOUT WRITE PROTECTION
2500:         MOVE TAC,J
2501:         TRO TAC1,400000
2502:         AOS -1(P)               ;SET FOR SUCCESS RETURN
    UUOCON page# 0067 next  prev
2504: ; CORE2 - SCAN FOR ALL JOBS USING THIS SEGMENT AND TELL THEM HE HAS CHANGED SIZE
2505: 
2506:         MOVEI J,JOBN-1          ;SET JOBRL2 FOR ALL JOBS USING THIS SEGMENT.
2507: SETRL2: LDB TEM,PSEGN
2508:         CAMN TEM,TAC
2509:         SKIPN PROG,JBTADR(J)
2510:         JRST .+2
2511:         MOVEM TAC1,JOBRL2(PROG)
2512:         SOJG J,SETRL2
2513: CORE2D: POP P,J
2514:         MOVE PROG,JBTADR(J)
2515:         JRST SEGXIT
2516: 
2517: CORE2C: POP P,(P)
2518:         POP P,TAC
2519:         POP P,J
2520:         JRST KILSEG
2521: 
    UUOCON page# 0068 next  prev
2523: ; ATTACH HIGH SEGMENT
2524: ; CALLING . . .
2525: ;       MOVE AC,<JOB NUMBER OR JOB NAME>
2526: ;       CALL AC,[SIXBIT /ATTSEG/]
2527: ;       <NO CAN DO, ERROR CODE IN AC>
2528: ;
2529: ; ERROR CODES:
2530: ; 0 - PROTECTION VIOLATION
2531: ; 1 - AMBIGUOUS ADDRESSEE
2532: ; 2 - NOT A HIGH SEGMENT
2533: ; 3 - DOES NOT EXIST
2534: ; 4 - ALREADY HAVE A HIGH SEGMENT
2535: 
2536: ATTSEG:
2537:         LDB     TAC1,PSEGN
2538:         SKIPN   JBTPR2(J)               ;CAN'T ATTACH WHILE DOING PEEK-POKE
2539:         JUMPE   TAC1,ATTSE5
2540:         MOVEI   TAC,4
2541:         JRST    ATTSER
2542: ATTSE5: TDNE    TAC,[-100]
2543:         JRST    ATTSGJ
2544: ATTSE1: MOVE    TAC1,JBTSTS(TAC)
2545:         TLNE    TAC1,JSEG
2546:         JRST    ATTSE6
2547:         MOVEI   TAC,1
2548: ATTSER: XCTR    XW,[MOVEM TAC,(UCHN)]
2549:         POPJ    P,
2550: 
2551: ATTSE6: PUSH    P,J
2552:         MOVE    J,TAC
2553:         PUSHJ   P,ACCESS
2554:         JRST    ATTSE7
2555:         JFCL
2556:         MOVE    TAC1,J
2557:         POP     P,J
2558:         DPB     TAC1,PSEGN
2559: IFN FTSTAT,<
2560:         PUSH P,TAC
2561:         PUSHJ P,SEGSTT
2562:         POP P,TAC
2563: >;FTSTAT
2564:         AOS     NJOBS(TAC1)             ; BUMP COUNT OF PEOPLE POINTING TO THIS SEGMENT
2565:         SKIPN   AC1,JBTDTS(J)           ;DOES HE HAVE A LIST OF DETACHED SEGMENTS?
2566:         JRST    ATTSE2                  ;NO.
2567: ATTSE3: LDB     DAT,PDSEGN              ;YES, IS THERE A SEGMENT NUMBER THERE
2568:         JUMPE   DAT,ATTSE2              ;NO SEGMENTS LEFT IN LIST
2569:         CAME    DAT,TAC1                ;IS THIS THE ONE IN QUESTION?
2570:         AOJA    AC1,ATTSE3              ;NO, TRY THE NEXT ONE
2571:         MOVE    TEM,AC1                 ;YES, RUN DOWN TO END OF LIST
2572:         ADDI    TEM,1                   ;UPDATE LIST OF DETACHED SEGMENTS
2573: ATTSE4: SKIPE   (TEM)                   ;IS THIS THE END OF LIST?
2574:         AOJA    TEM,ATTSE4              ;NO, TRY AGAIN
2575:         MOVE    DAT,-1(TEM)             ;MOVE LAST WORD ONTO WHERE WE'RE DELETING
2576:         MOVEM   DAT,(AC1)
2577:         SETZM   -1(TEM)                 ;ZERO THE END OF THE LIST
2578:         SUBI    TEM,1
2579:         CAME    TEM,JBTDTS(J)           ;DOES HE HAVE ANY DETACHED SEGMENTS LEFT?
2580:         JRST    ATTSE2                  ;YES, WE ARE DONE
2581:         MOVE    AC1,JBTDTS(J)           ;NO, WE CAN GIVE BACK FREE STORAGE
2582:         PUSHJ   P,FSGIVE
2583:         SETZM   JBTDTS(J)
2584: ATTSE2: AOS     (P)
2585:         PUSHJ   P,WSCHED                ;MAKE SURE SEGMENT IS IN CORE
2586:         JRST    SEGXIT                  ; NOW GO SET PROT-RELOC
    UUOCON page# 0069 next  prev
2588: ;ATTSEG  SEARCH FOR A SEGMENT OF A GIVEN NAME
2589: ATTSGJ: MOVE    DAT,JOBNM1
2590: ATTSG1: CAME    TAC,JOBNAM(DAT)
2591:         JRST    ATTSG4
2592:         MOVE    TAC1,JBTSTS(DAT)
2593:         TLNN    TAC1,JSEG
2594:         JRST    ATTSG4
2595:         MOVE    TAC1,DAT
2596:         JRST    ATTSG2
2597: ATTSG4: SOJG    DAT,ATTSG1
2598:         MOVEI   TAC,3
2599:         JRST    ATTSER
2600: 
2601: ATTSG3: CAME    TAC,JOBNAM(DAT)
2602:         JRST    ATTSG2
2603:         MOVE    TEM,JBTSTS(DAT)
2604:         TLNN    TEM,JSEG
2605:         JRST    ATTSG2
2606:         MOVEI   TAC,1
2607:         HRL     TAC,DAT
2608:         JRST    ATTSER
2609: 
2610: ATTSG2: SOJG    DAT,ATTSG3
2611:         MOVE    TAC,TAC1
2612:         JRST    ATTSE1          ;GO TRY IT
2613: 
2614: ATTSE7: POP     P,J
2615:         MOVEI   TAC,0
2616:         JRST    ATTSER
    UUOCON page# 0070 next  prev
2618: ;DETSEG  DETACH SEGMENT
2619: ; CALLING . . .
2620: ;       CALL AC,[SIXBIT /DETSEG/]
2621: ; IF AC=0, THEN THE SEGMENT IS DETACHED AND PLACED INTO A LIST
2622: ; OF THE SEGMENTS THIS GUY HAS DETACHED, SUCH THAT WHEN THE
2623: ; SYSTEM CALLES RESET, ALL HIS DETACHED SEGMENTS GO AWAY. IF AC LOW
2624: ; ORDER BIT IS ON, SEGEMENT WILL BE SPECIALLY DETACHED- WILL STICK AROUND
2625: ; UNTIL THE MAKER KJOBS.
2626: 
2627: DETSEG:
2628:         SKIPE   JBTPR2(J)               ;DOING PEEK-POKE?
2629:         JRST    [SETZM  JBTPR2(J)       ;FLUSH PEEK-POKE
2630:                 JRST    SEGXIT]
2631:         LDB     TAC1,PSEGN
2632:         JUMPE   TAC1,CPOPJ              ;NO HIGH SEGMENT HERE, HOW STRANGE!
2633:         SKIPE   AC1,JBTDTS(J)           ;PUT THIS ON THE LIST OF DETACHED SEGMENTS.
2634:         JRST    DETSE1                  ;HE HAS A DETACHED SEGMENT LIST ALREADY.
2635:         MOVEI   AC3,JOBN                ;NO, GET HIM ONE ABOUT THIS LONG.
2636:         PUSHJ   P,UFSGET
2637:         HRRZM   AC1,JBTDTS(J)
2638:         JRST    DETSE2
2639: 
2640: DETSE1: SKIPE   (AC1)                   ;NOW RUN DOWN TO END OF LIST
2641:         AOJA    AC1,DETSE1
2642: DETSE2: TRNE    UCHN,1                  ;DOES HE HAVE THE 1-BIT ON IN THE AC FIELD?
2643:         TLO     TAC1,400000             ;YES, SET SPECIAL DET SEG.
2644:         MOVEM   TAC1,(AC1)              ;PUT THIS SEGMENT NUMBER IN THE TABLE
2645:         SOSGE   NJOBS(TAC1)
2646:         PUSHJ   P,NJERR
2647:         SETZB   TAC,1(AC1)              ;AND MARK THE END OF LIST
2648:         DPB     TAC,PSEGN
2649: IFN FTSTAT,<
2650:         PUSHJ P,SEGSTT
2651:         LDB TAC,PSEGN
2652: >;FTSTAT
2653:         JRST    SEGXIT
2654: 
2655: NJERR:  PUSHACS
2656:         PUSHJ   P,DISMES
2657:         ASCIZ   /NJOB WENT NEGATIVE AT DETSEG
2658: /
2659:         POPACS
2660:         SETZM   NJOBS(TAC1)
2661:         POPJ    P,
    UUOCON page# 0071 next  prev
2663: ; DETSEG - COMMON SEGMENT UUO EXIT ROUTINE
2664: 
2665: SEGXT1: AOS (P)
2666: SEGXIT: PUSHJ P,GETPR
2667:         DATAO APR,TAC
2668:         LSH TAC,-11     ;SET JOBHRL DIRECTLY FROM PR WD SO SETPR2 WILL WIN TOO
2669:         TRNN TAC,JWP<22-11>
2670:         TLZA TAC,-1
2671:         HRLI TAC,400000
2672:         IORI TAC,401777
2673:         CAMN PROG,JBTADR(J)
2674:         JRST SEGXT3
2675:         PUSHACS
2676:         PUSHJ P,DISMES
2677:         ASCIZ/πππPROG CLOBBERED AT SEGXIT
2678: PROG=/
2679:         MOVE TAC,PROG
2680:         PUSHJ P,DISOCT
2681:         POPACS
2682:         MOVE PROG,JBTADR(J)
2683: SEGXT3: MOVEM TAC,JOBRL2(PROG)
2684:         POPJ P,
    UUOCON page# 0072 next  prev
2686: ; GET NUMBER OF SEGMENT BELONGING TO JOB N
2687: ; IF N IS ZERO, RETURNS YOUR SEGMENT NUMBER
2688: ; ZERO RETURNED MEANS NO SEGMENT
2689: 
2690: SEGNUM:
2691:         CAIL    TAC,0
2692:         CAIL    TAC,JOBN
2693:         JRST    UUOERR
2694:         CAIN    TAC,0
2695:         MOVE    TAC,J
2696:         MOVE    J,TAC
2697:         LDB     TAC,PSEGN
2698:         XCTR    XW,[MOVEM TAC,(UCHN)]
2699:         POPJ    P,
    UUOCON page# 0073 next  prev
2701: ; SEGSIZ CALLING . . .
2702: ;       CALL AC,[SIXBIT /SEGSIZ/]
2703: ; RETURNS HIGHEST LEGAL ADDRESS IN UPPER SEGMENT
2704: ; MINUS 400000
2705: ; RETURNS ZERO IF YOU DO NOT HAVE AN UPPER SEGMENT
2706: 
2707: SEGSIZ:
2708:         LDB TAC,PSEGN
2709:         JUMPE TAC,STOTAC
2710:         HLRZ TAC,JBTADR(TAC)
2711:         JRST STOTAC
    UUOCON page# 0074 next  prev
2713: ; SETNM2 CALLING . . .
2714: ;       MOVE AC,[SIXBIT /<NAME YOU WISH YOUR UPPER TO HAVE>/]
2715: ;       CALL AC,[SIXBIT /SETNM2/]
2716: ;       <ERROR RETURN>
2717: ; IF YOU HAVE AN UPPER SEGMENT, GIVES IT THE NAME IN ACCUMULATOR AC.
2718: ; IF YOU DON'T HAVE AN UPPER, THIS UUO IS A NO-OP.
2719: ; UPON SUCCESS, AC IS CLEARED, UNLESS THERE IS ANOTHER SEGMENT OF THE SAME NAME,
2720: ;        IN WHICH CASE YOU GET ITS JOB NUMBER
2721: 
2722: SETNM2:
2723:         LDB TAC1,PSEGN
2724:         JUMPE TAC1,CPOPJ1
2725:         PUSH P,TAC
2726:         PUSH P,J
2727:         MOVE J,TAC1
2728:         PUSHJ P,ACCESS
2729:         JFCL
2730:         JRST SETNM5
2731:         POP P,TAC1
2732:         POP P,JOBNAM(J)
2733: IFN FTSTAT,<PUSHJ P,NAMSTT>
2734:         MOVEI TAC1,JOBN-1
2735: SETNM3: MOVE DAT,JBTSTS(TAC1)
2736:         TLNN DAT,JSEG
2737:         JRST SETNM4
2738:         MOVE DAT,JOBNAM(TAC1)
2739:         CAME TAC1,J
2740:         CAME DAT,JOBNAM(J)
2741: SETNM4: SOJG    TAC1,SETNM3
2742:         XCTR    XW,[MOVEM TAC1,(UCHN)]
2743:         JRST    CPOPJ1
2744: 
2745: SETNM5: POP P,J
2746:         JRST TPOPJ
    UUOCON page# 0075 next  prev
2748: ; ROUTINE TO GET YOUR SEGMENT'S NAME
2749: ; CALLING . . .
2750: ;       CALL AC,[SIXBIT /SEGNAM/]
2751: ; NAME (OR 0) RETURNED IN ACCUMULATOR
2752: 
2753: SEGNAM:
2754:         LDB J,PSEGN
2755:         MOVE TAC,JOBNAM(J)
2756:         JRST STOTAC
    UUOCON page# 0076 next  prev
2758: ; THIS UUO FIRST KILLS ANY HIGH SEGMENT YOU MAY HAVE.
2759: ; CALLING . . .
2760: ;       CALL [SIXBIT /LINKUP/]
2761: ;       <NO CAN DO>
2762: ; IT THEN ATTEMPTS TO MAKE A LINKUP WITH ANY HIGH SEGMENT
2763: ; IN CORE WITH YOUR CREDENTIALS.
2764: 
2765: LINKUP:
2766:         PUSHJ P,LINKSEG
2767:         POPJ P,
2768:         JRST ATTSE2             ; BRING UPPER INTO CORE, AND SKIP RETURN
    UUOCON page# 0077 next  prev
2770: ; RETURNS LIST OF JOB NUMBERS WHO POINT TO YOUR UPPER SEGMENT.
2771: ; THE LIST TERMINATES WITH A ZERO
2772: ; IF YOU HAVE NO UPPER SEGMENT, ZERO IS RETURNED IN ADR
2773: ; ADR BETTER BE AT LEAST JOBN WORDS LONG.
2774: ; CALLING . . .
2775: ;       POINTS ADR
2776: 
2777: POINTS:
2778:         LDB     DAT,PSEGN
2779:         JUMPE   DAT,POINT3
2780:         MOVEI   J,JOBN-1
2781: POINT2: LDB     TAC1,PSEGN
2782:         CAME    TAC1,DAT
2783:         JRST    POINT1
2784:         XCTR    XW,[MOVEM J,(UUO)]
2785:         ADDI    UUO,1
2786: POINT1: SOJG    J,POINT2
2787: POINT3: XCTR    XW,[SETZM (UUO)]
2788:         POPJ    P,
    UUOCON page# 0078 next  prev
2790: ; SET PROTECTION ON A HIGH SEGMENT
2791: ; CALLING . . .
2792: ;       MOVE AC,<0-8 NEW PROTECTION KEY; 30-35 SEGMENT NUMBER>
2793: ;       CALL AC,[SIXBIT /SETPRO/]
2794: ;       <NO CAN DO>
2795: ;
2796: ; IF SEGMENT NUMBER IS ZERO, REFERS TO YOUR OWN SEGMENT
2797: 
2798: SETPRO:
2799:         PUSH P,TAC
2800:         PUSH P,J
2801:         LDB J,[POINT 6,TAC,35]
2802:         SKIPE J
2803:         JRST SETP3
2804:         MOVE J,(P)
2805:         LDB J,PSEGN
2806:         JUMPN J,SETP3
2807: SETP1:  POP P,J
2808:         POP P,TAC
2809:         POPJ P,
2810: 
2811: SETP3:  MOVE TAC1,JBTSTS(J)
2812:         TLNN TAC1,JSEG
2813:         JRST SETP1
2814:         PUSHJ P,ACCESS
2815:         JFCL
2816:         JRST SETP1
2817:         MOVE TAC1,(P)
2818:         MOVE TAC1,JBTPRV(TAC1)
2819:         TLNE TAC1,SEGPRV        ;SKIP UNLESS HE HAS SEGMENT PRIV
2820:         JRST SETP2              ;SEG PRIV. HE WINS
2821:         TRNE TAC,400            ;PROTECTION PROTECTED?
2822:         JRST SETP1
2823: SETP2:  MOVE TAC,-1(P)
2824:         LSH TAC,-=27
2825:         ANDI TAC,377            ;ONLY REAL BITS
2826:         DPB TAC,[POINT =9,JOBCRD(J),8]
2827:         AOS -2(P)
2828:         JRST SETP1
2829: 
2830: BEND SEGUUO
    UUOCON page# 0079 next  prev
2832:         SUBTTL  INTUUO - UUOS FOR NEW STYLE INTERRUPT SYSTEM
2833: ; UUO TO SET THE PROCESSOR RUNNING MASK
2834: ; CALLING . . .
2835: ;       MOVE AC,[<RUN BITS>]
2836: ;       CALL AC,[SIXBIT /RUNMSK/]
2837: ; THE BITS ARE
2838: ; BIT 35 - RUNNABLE ON P1
2839: ; BIT 34 - RUNNABLE ON P2
2840: 
2841: RUNMSK:
2842: REPEAT 0,<
2843:         DPB TAC,PRUNB
2844: >
2845:         POPJ P,
    UUOCON page# 0080 next  prev
2847: ; INTENB
2848: ; ENABLE INTERRUPTS . . .
2849: ;       MOVE AC,[MAGIC BITS]
2850: ;       CALL AC,[SIXBIT /INTENB/]
2851: 
2852: INTENB: PUSHJ P,INTCHK
2853:         MOVE AC1,JBTIEN(J)      ;OLD ENABLINGS
2854:         MOVEM TAC,JBTIEN(J)     ;NEW ENABLINGS
2855:         XOR AC1,TAC
2856:         TLNN AC1,INTCLK         ;SKIP IF INTCLK CHANGING
2857:         JRST INTAPC             ;INTAPC NEEDS TAC = JBTIEN
2858:         TLNN TAC,INTCLK         ;SKIP IF TURNING INTCLK ON
2859:         JRST INTEN1             ;TURNING IT OFF
2860:         PUSHJ P,CLKENB          ;PLANT CLOCK REQUEST IN APRLST FOR 1 TICK
2861:         JRST INTAPC
2862: 
2863: INTEN1: PUSHJ P,INTAPC
2864:         MOVSI TAC,INTCLK
2865:         ANDCAM TAC,JBTIRQ(J)    ;FLUSH PENDING CLOCK INTERRUPT
2866:         JRST APRDKL             ;KILL ANY CLOCK REQUESTS WE MIGHT HAVE
2867: 
2868: INTCHK: TLZ TAC,INTWAIT         ;UUO WAIT IS THE ONLY PROTECTED INTERRUPT BIT
2869:         TDNN TAC,JOBENB(PROG)
2870:         POPJ P,
2871: INTLOS: JSP TAC,UUOMES
2872:         ASCIZ /CONFLICT BETWEEN INTERRUPT ENABLINGS
2873: UUO/
    UUOCON page# 0081 next  prev
2875: ; CLKENB, CLKENA  - ENABLE FOR USER CLOCK INTERRUPTS
2876: ; CLKENA - SAME AS CLKENB EXCEPT TAC HAS NUMBER OF TICKS FOR REQ
2877: 
2878: CLKENB: PUSH P,TAC
2879:         TDZA TAC,TAC            ;FLAG NOT TO STORE TIME
2880: CLKENA: PUSH P,TAC
2881:         JUMPN PID,TPOPJ         ;NO INTERRUPTS ON P2
2882: CLKNB1: CONO PI,APROFF
2883:         SKIPN AC1,APRLST
2884:         JRST CLKNB2             ;HAVE TO CREATE APRLST BLOCK
2885: CLKNBL: SKIPN AC2,(AC1)         ;FIND THE FIRST BLANK SPOT
2886:         JRST CLKNB5             ;END OF LIST AND THIS JOB HAS NO REQ YET
2887:         CAIN J,(AC2)            ;IS THERE AN ENTRY FOR THIS JOB?
2888:         JRST CLKNB4
2889:         ADDI AC1,2              ;LOOP AROUND
2890:         JRST CLKNBL
2891: 
2892: CLKNB2: CONO PI,APRON
2893:         MOVEI AC3,2*JOBN
2894:         PUSHJ P,UFSGET          ;GET A BLOCK OF FREE STORAGE
2895:         SETZM (AC1)
2896:         CONO PI,APROFF
2897:         SKIPN APRLST            ;SEE IF SOMEONE ELSE HAS MADE IT ALREADY
2898:         JRST CLKNB3             ;NO, WE STILL GET TO DO IT
2899:         CONO PI,APRON
2900:         PUSHJ P,FSGIVE          ;FALSE ALARM
2901:         JRST CLKNB1
2902: CLKNB3: MOVEM AC1,APRLST
2903:         JRST CLKNBL
2904: 
2905: CLKNB4: JUMPE TAC,CLKNB7        ;ALREADY AN ENTRY AND DON'T CHANGE TIME
2906: CLKNB6: HRLM TAC,(AC1)
2907:         MOVNM TAC,1(AC1)
2908: CLKNB7: CONO PI,APRON
2909:         POP P,TAC
2910:         POPJ P,
2911: 
2912: CLKNB5: SETZM 2(AC1)            ;MAKE A FRESH ENTRY
2913:         HRRZM J,(AC1)
2914:         JUMPN TAC,CLKNB6        ;STORE NEW TIME
2915:         MOVEI TAC,1
2916:         JRST CLKNB6
    UUOCON page# 0082 next  prev
2918: ; INTORM - ROUTINE TO SET BITS IN INTERUPT ENABLE MASK
2919: 
2920: INTORM: PUSHJ P,INTCHK
2921:         MOVE AC1,TAC            ;INTERRUPT BITS BEING TURNED ON
2922:         IORB TAC,JBTIEN(J)      ;TAC MUST HAVE JBTIEN AT INTAPC
2923:         TLNE AC1,INTCLK
2924:         PUSHJ P,CLKENB          ;PLANT CLOCK REQ FOR 1 TICK
2925:         JRST INTAPC
    UUOCON page# 0083 next  prev
2927: ; INTACM - CLEARS BITS IN INTERRUPT ENABLE MASK
2928: 
2929: INTACM: PUSHJ P,INTCHK
2930:         MOVE AC1,TAC            ;INTERRUPT BITS BEING TURNED OFF
2931:         ANDCAB TAC,JBTIEN(J)
2932:         TLNE AC1,INTCLK         ;SKIP IF NOT CLEARING INTCLK
2933:         JRST INTEN1
2934: INTAPC: ANDI TAC,CPUMSK
2935:         HRRZM TAC,APRIN2(PID)   ;ONLY LEGAL BITS
2936:         IOR TAC,JOBENB(PROG)
2937:         ANDI TAC,CPUMSK!1000    ;MASK THIS TOO, SINCE IT'S UNPROTECTED
2938:         JRST APREN2             ;SET UP PROCESSOR CONO
    UUOCON page# 0084 next  prev
2940: ; INTENS, INTIIP - ROUTINES TO GIVE BACK INFORMATION
2941: 
2942: INTENS: SKIPA TAC,JBTIEN(J)
2943: INTIIP: MOVE TAC,JBTIIP(J)
2944:         JRST STOTAC
    UUOCON page# 0085 next  prev
2946: ; INTIRQ - TELLS YOU WHAT INTERRUPTS ARE PENDING
2947: 
2948: INTIRQ: MOVE TAC,JBTIRQ(J)
2949:         JRST STOTAC
    UUOCON page# 0086 next  prev
2951: ; DISMIS - TERMINATES CURRENT I-LEVEL RUN
2952: 
2953: DISMIS: SKIPE INTACT(PID)
2954:         JRST DISM2
2955:         SKIPE SPWUUF(PID)
2956:         JRST SPWXIT             ;MUST LEAVE THROUGH HERE!!!!!!!
2957:         JRST DISLOS
2958: DISM2:  MOVEI AC1,INTDSM
2959: DISM1:  JUMPE UCHN,DISM3        ;NONZERO AC FIELD REQUEUES JOB AS SPEC BY C(AC)
2960:         MOVM TAC,JOBQUE(J)
2961:         XCTR XR,[MOVE TAC1,(UCHN)]      ;LH(AC) IS MASK FOR LEGAL SOURCE Q'S
2962:         LSH TAC1,(TAC)
2963:         JUMPGE TAC1,DISM3               ;NOT IN LEGAL SOURCE Q
2964:         XCTR XR,[HRRZ TAC,(UCHN)]       ;GET NEW CODE
2965:         CAIL TAC,NDISQS
2966:         JRST DISM3                      ;OUT OF BOUNDS
2967:         MOVE TAC,DISQTB(TAC)
2968:         MOVEM TAC,JOBQUE(J)
2969:         PUSHJ P,REQUE
2970: DISM3:  CONO PI,PIOFF           ;AVOID EXTRANEOUS CLK INTS
2971:         MOVEM AC1,INTDISP(PID)
2972:         HLLOS CLKFLG(PID)               ; MAKE SURE CH7 KNOWS WE'RE COMING!
2973:         CONO PI,PION!1B24!1(7-CLKCHN)
2974:         JUMPN PID,CL2INT
2975:         JRST CLKINT
2976: 
2977: DISLOS: JSP TAC,UUOMES
2978: ASCIZ /I-LEVEL UUO GIVEN WHEN NOT AT I-LEVEL
2979: UUO/
2980: 
2981: DISQTB: TQ              ;THESE ARE POSITIVE SO THEY WON'T GENERATE QXFER INTS
2982:         RUNQ
2983:         INTWQ
2984:         IOWQ
2985: NDISQS←←.-DISQTB
    UUOCON page# 0087 next  prev
2987: ; INTGEN - ROUTINE TO GENERATE AN INTERRUPT FOR YOURSELF
2988: 
2989: INTGEN: SETCM AC1,JBTIEN(J)
2990:         TDNN AC1,TAC
2991:         JRST INTGN1
2992:         JSP TAC,UUOMES
2993:         ASCIZ /ATTEMPT TO GENERATE NON-ENABLED INTERRUPT
2994: UUO/
2995: INTGN1: IORM TAC,JBTIRQ(J)
2996:         SETOM INTREQ(PID)
2997:         SKIPN INTACT(PID)
2998:         JRST WSCHED
2999:         POPJ P,
    UUOCON page# 0088 next  prev
3001: ; USKIP - ROUTINE TO TELL USER IF HE IS INSIDE A UUO
3002: 
3003: USKIP:  SKIPN INTACT(PID)
3004:         JRST DISLOS
3005:         MOVE AC1,USRPC(PID)     ;PC OF SUSPENDING MAIN JOB
3006:         TLNN AC1,USRMOD
3007:         AOS (P)
3008:         POPJ P,
    UUOCON page# 0089 next  prev
3010: ; UWAIT - WAITS FOR UUO TO TERMINATE
3011: 
3012: UWAIT:  PUSHJ P,USKIP           ;SKIP IF INTERRUPTED OUT OF A UUO, RETURNING
3013:         JRST UWNPC              ; IN AC1 THE PC OF THE SUSPENDED PROCESSES
3014:         MOVE DSER,JBTSTS(J)     ; HE HAS BEEN REQUEUED IF HE IS IN INTERRUPT WAIT,
3015:                                 ; NOW CHECK FOR SLEEPING.
3016:         TLNE DSER,CLKR          ; DOES HE HAVE A SLEEP REQUEST IN?
3017:         PUSHJ P,UWAIT1          ; YES, GO WAKE HIM UP
3018:         MOVSI AC1,INTWAIT
3019:         IORM AC1,JBTIEN(J)
3020:         IORM AC1,JBTMSK(J)
3021:         MOVE AC1,UUOPC(J)
3022:         MOVEM AC1,JBTUPC(J)     ;USER ADDRESS AFTER UWAIT
3023:         JRST DISMIS
3024: 
3025: UWAIT1: MOVE TAC,J              ;SIMULATE UUO LEVEL CALL BY PUTTING JOB NUMBER IN TAC
3026:         JRST WAKE
3027: 
3028: UWNPC:  MOVEM AC1,JOBTPC(PROG)
3029:         MOVSI AC1,JOBDAC(PROG)  ;GET MAIN PROGRAM ACS (20-37) BACK INTO REAL ACS
3030:         HRRI AC1,JOBAC(PROG)
3031:         BLT AC1,JOBAC+17(PROG)
3032:         POPJ P,
    UUOCON page# 0090 next  prev
3034: ; DEBREAK - MAKES I-LEVEL PROCESS TAKE PLACE OF U-LEVEL PROCESS
3035: 
3036: DEBREAK:
3037:         SKIPN INTACT(PID)
3038:         JRST DISLOS
3039:         MOVEI AC1,INTDEB
3040:         JRST DISM1
    UUOCON page# 0091 next  prev
3042: ; IWAIT - GO INTO INTERRUPT WAIT UNTIL AWAKENED BY AN APPROPRIATE INTERRUPT
3043: 
3044: IWAIT:  MOVEI AC1,INTWQ
3045:         MOVNM AC1,JOBQUE(J)
3046:         JRST WSCHED
    UUOCON page# 0092 next  prev
3048: ; ROUTINE TO ENABLE INTERRUPTS AND THEN GO INTO INTERRUPT WAIT
3049: ; CALLING . . .
3050: ;       MOVE AC,[<INTERRUPT BITS>]
3051: ;       CALL AC,[SIXBIT /IENBW/]
3052: ; YOU ARE NOW IN INTERRUPT WAIT.
3053: 
3054: IENBW:  MOVEI AC1,INTWQ         ; PUT US IN INTERRUPT WAIT
3055:         MOVNM AC1,JOBQUE(J)
3056:         PUSHJ P,INTENB          ; ENABLE INTERRUPTS
3057:         JRST WSCHED             ; WAIT.
    UUOCON page# 0093 next  prev
3059: ;;UUOS TO SET THE INTERRUPT MASK
3060: ; CALLING . . .
3061: ;       INTMSK [<MASK BITS>]
3062: 
3063: 
3064: INTMSK: XCTR XR,[MOVE AC1,(UUO)]
3065:         MOVEM AC1,JBTMSK(J)
3066: IMCALL: SKIPN INTACT(PID)       ;DON'T CALL WSCHED IF ALREADY AT I-LEVEL
3067:         TDNN AC1,JBTIRQ(J)      ; DOES HE HAVE ANY INTERRUPTS PENDING?
3068:         POPJ P,
3069:         SETOM INTREQ(PID)       ; YES, GIVE THEM
3070:         JRST WSCHED
    UUOCON page# 0094 next  prev
3072: ;IMSKST  IMSKCL
3073: ; THIS ONE SETS BITS IN THE MASK . . .
3074: 
3075: IMSKST: XCTR XR,[MOVE AC1,(UUO)]
3076:         IORM AC1,JBTMSK(J)
3077:         JRST IMCALL
3078: 
3079: ; AND THIS ONE CLEARS BITS . . .
3080: 
3081: IMSKCL: XCTR XR,[MOVE AC1,(UUO)]
3082:         ANDCAM AC1,JBTMSK(J)
3083:         POPJ P,
    UUOCON page# 0095 next  prev
3085: ; CLKINT UUO  (CLKUUO) START UP A CLOCKED I-LEVEL JOB
3086: ; CALLING . . .
3087: ;       CLKINT TIX
3088: ; TIX IS THE TIME IN TICKS BETWEEN STARTUPS
3089: ; IF TIX IS ZERO, ANY CLOCKED JOB IS FLUSHED
3090: 
3091: CLKUUO: TRNN UUO,-1             ;ZERO TIX?
3092:         JRST CLKUU2             ;YES, GO KILL JOB
3093:         MOVSI TAC,INTCLK
3094:         IORM TAC,JBTIEN(J)      ;ENABLE CLOCK INTERRUPTS
3095:         ANDCAM TAC,JBTIRQ(J)    ;FLUSH PENDING OLD CLOCK INTERRUPT
3096:         HRRZ TAC,UUO
3097:         JRST CLKENA             ;PLANT THE CLOCK REQUEST
3098: 
3099: CLKUU2: PUSHJ P,APRDKL          ;KILL CLOCK REQUEST
3100:         MOVSI TAC,INTCLK
3101:         ANDCAM TAC,JBTIEN(J)
3102:         ANDCAM TAC,JBTIRQ(J)
3103:         POPJ P,
    UUOCON page# 0096 next  prev
3105: ;INTUUO - INTDEJ, IMSTW
3106: ; MULTI-PURPOSE INTERRUPT UUO
3107: 
3108: INTUUO: CAILE UCHN,INTMXU
3109:         JRST UUOERR
3110:         JRST @INTUTB(UCHN)
3111: 
3112: DEFINE UUOS{FOR X IN(INTDEJ,IMSTW,IWKMSK,INTDMP,INTIPI,IMSKCR)}
3113: 
3114: UUOMAC INTUTB,INTUUO
3115: INTMXU←←UUOCNT
3116: 
3117: ; RESET INTERRUPT MASK AND JUMP TO ADDRESS UUO.
3118: ; CALLING . . .
3119: ;       INTDEJ ADR
3120: ; WITH THE FOLLOWING DATA . . .
3121: ; ADR:  <INTERRUPT BITS TO BE ORED INTO MASK>
3122: ;       <PC WORD TO GO TO>
3123: ; THIS UUO DOES NOT RETURN, BUT INSTEAD JUMPS TO THE ADDRESS
3124: 
3125: INTDEJ: XCTR XR,[MOVE TAC,1(UUO)];FETCH PC WORD
3126:         TLO TAC,USRMOD          ; KEEP THE LOSER OUT OF THE SYSTEM
3127:         PUSH P,TAC
3128:         PUSHJ P,IMSKST          ; OR IN MASK BITS
3129:         POP P,UUOPC(J)          ; SET UP RETURN ADDRESS
3130:         POPJ P,                 ; RETURN TO LOSER
3131: 
3132: ; SET MASK FROM FIRST WORD OF UUO AND GO INTO WAIT STATE.
3133: ; CALLING . . .
3134: ;       IMSTW ADR
3135: ;
3136: ; ADR:  <MASK BITS>
3137: 
3138: IMSTW:  MOVEI AC1,INTWQ         ; PUT US INTO INTERRUPT WAIT FIRST
3139:         MOVNM AC1,JOBQUE(J)
3140:         PUSHJ P,INTMSK          ; SET THE MASK
3141:         JRST WSCHED             ; DO THE WAIT STATE THING.
    UUOCON page# 0097 next  prev
3143: ; IWKMSK, IMSKCR
3144: ; SET MASK THAT ALLOWS THE MAIN JOB TO BE AWAKENED
3145: ; FROM IWAIT QUEUE.
3146: ; CALLING . . .
3147: ;       IWKMSK ADR
3148: ;
3149: ; ADR:  <INTERRUPT BITS WHICH SHOULD AWAKEN>
3150: 
3151: IWKMSK: XCTR XR,[MOVE TAC,(UUO)]
3152:         MOVEM TAC,JBTWKM(J)
3153:         POPJ P,
3154: 
3155: ;CLEAR SPECIFIED BITS OF MASK (PDP-10 ONLY) AND RETURN OLD MASK
3156: ;CALL:
3157: ;       IMSKCR ADR
3158: ;
3159: ;ADR:   BITS TO TURN OFF IN MASK, REPLACED BY OLD MASK VALUE
3160: 
3161: IMSKCR: MOVE TAC,JBTMSK(J)
3162:         XCTR XR,[ANDCM TAC,(UUO)]
3163:         EXCH TAC,JBTMSK(J)
3164:         JRST STOTAC
    UUOCON page# 0098 next  prev
3166: ; INTDMP
3167: ; ROUTINE TO DUMP OUT INFORMATION ABOUT A PARTICULAR JOB'S INTERRUPT
3168: ; CONDITION. CALLING . . .
3169: ;       INTDMP ADR
3170: ;       <FAILURE - ERROR CODE IN ADR+1>
3171: ;
3172: ; ADR:  <JOB NUMBER OR JOB NAME>
3173: ;       <ENABLE BITS OR ERROR CODE, 1 FOR NON-EX JOB NUMBER,
3174: ;               2 FOR AMBIGUOUS JOB NAME, 3 FOR NON-EX JOB NAME>
3175: ;       <P1 INTERRUPT MASK>
3176: ;       ZERO
3177: ;       <WAKEUP MASK>
3178: ;       <JOB QUEUE>
3179: 
3180: INTDMP: XCTR XR,[MOVE TAC,(UUO)]        ;PICK UP JOB NUMBER OR NAME
3181:         TDNE TAC,[-100]         ; SEE WHICH IT IS
3182:         JRST INTDGJ             ; NAME, FIND OUT WHICH
3183:         JUMPE TAC,INTDM2        ; IF ZERO, USE HIS OWN
3184:         CAIL TAC,JOBN           ; IS JOB NUMBER IN BOUNDS?
3185:         JRST INTDR1             ; NO.  GIVE BAD JOB # ERROR RETURN
3186: INTDM1: MOVE AC1,JBTIEN(TAC)    ; GIVE THE GUY HIS ENABLE BITS
3187:         XCTR XW,[MOVEM AC1,1(UUO)]
3188:         MOVE AC1,JBTMSK(J)      ; AND HIS PROCESSOR MASKS
3189:         XCTR XW,[MOVEM AC1,2(UUO)]
3190:         XCTR XW,[SETZM 3(UUO)]
3191:         MOVE AC1,JBTWKM(TAC)    ; HIS WAKEUP MASK
3192:         XCTR XW,[MOVEM AC1,4(UUO)]
3193:         MOVM AC1,JOBQUE(TAC)    ; AND HIS CURRENT QUEUE
3194:         XCTR XW,[MOVEM AC1,5(UUO)]
3195:         JRST CPOPJ1             ; GIVE SUCCESS RETURN
    UUOCON page# 0099 next  prev
3197: ; INTDMP - ERROR RETURNS
3198: 
3199: INTDM2: MOVE TAC,J
3200:         JRST INTDM1
3201: 
3202: INTDR3: MOVEI AC1,3
3203:         JRST INTDR4
3204: 
3205: INTDR2: SKIPA AC1,[2]
3206: INTDR1: MOVEI AC1,1
3207: INTDR4: XCTR XW,[MOVEM AC1,1(UUO)]
3208:         POPJ P,
3209: 
3210: INTDGJ: PUSHJ P,GJOBN           ; GET JOB NUMBER FROM NAME IN TAC
3211:         JRST INTDR2             ; AMBIGUOUS NAME
3212:         JRST INTDR3             ; NON-EX NAME
3213:         JRST INTDM1             ; WIN!
    UUOCON page# 0100 next  prev
3215: ; ROUTINE TO GET A JOB NUMBER FROM A JOB NAME
3216: 
3217: GJOBN:  MOVEI AC1,JOBN-1
3218: GJOBN1: CAMN TAC,JOBNAM(AC1)
3219:         JRST GJOBN2
3220: GJOBN4: SOJG AC1,GJOBN1
3221:         JRST CPOPJ1
3222: 
3223: GJOBN2: MOVE AC2,JBTSTS(AC1)
3224:         TLNE AC2,JSEG
3225:         JRST GJOBN4
3226:         MOVE AC2,AC1
3227:         JRST GJOBN5
3228: GJOBN3: CAMN TAC,JOBNAM(AC2)
3229:         POPJ P,
3230: GJOBN5: SOJG AC2,GJOBN3
3231:         MOVE TAC,AC1
3232:         JRST CPOPJ2
    UUOCON page# 0101 next  prev
3234: ; INTIPI
3235: ; INTER-PROCESS INTERRUPT SYSTEM
3236: ; CALLING . . .
3237: ;       INTIPI ADR
3238: ;       <ERROR - CODE IN ADR+1 - 1 FOR NON-EX JOB NUMBER
3239: ;                       2 FOR AMBIGUOUS JOB NAME
3240: ;                       3 FOR NON-EX JOB NAME
3241: ;                       4 FOR JOB NOT ENABLED FOR THOSE INTERRUPTS>
3242: ; ADR:  <JOB NUMBER OR NAME>
3243: ;       <INTERRUPT BITS OR ERROR CODE>
3244: 
3245: INTIPI: XCTR XR,[MOVE TAC,(UUO)]        ;GET JOB NAME OR NUMBER
3246:         TDNE TAC,[-100]
3247:         JRST INTIP1             ;JOB NAME
3248:         JUMPE TAC,INTIP2        ;IF 0 USE OWN JOB
3249:         CAIL TAC,JOBN
3250:         JRST INTDR1
3251: INTIP3: XCTR XR,[MOVE AC1,1(UUO)]       ;INTERRUPT BITS
3252:         SETCM AC2,JBTIEN(TAC)
3253:         TDNE AC1,AC2
3254:         JRST INTIR4
3255:         IORM AC1,JBTIRQ(TAC)
3256:         SETOM INTREQ(PID)
3257:         JRST CPOPJ1
3258: 
3259: INTIP1: PUSHJ P,GJOBN
3260:         JRST INTDR2             ;AMBIGUOUS
3261:         JRST INTDR3             ;NOT FOUND
3262:         JRST INTIP3             ;UNIQUE
3263: 
3264: INTIP2: MOVE TAC,J
3265:         JRST INTIP3
3266: 
3267: INTIR4: MOVEI AC1,4
3268:         JRST INTDR4
    UUOCON page# 0102 next  prev
3270: SUBTTL  UUOCON - STANFORD SPECIAL IO ROUTINES
3271: ;;UUO TO GET USE BITS FOR A CHANNEL
3272: ;       CHNSTS <CHANNEL NUMBER>,ADR
3273: ; PUTS USRJDA IN ADR, 0 FOR UNUSED.
3274: 
3275: CHNSTS:
3276:         CAMLE   UCHN,USRHCU(PID)
3277:         TDZA    TAC,TAC
3278:         HLRZ    TAC,USRJDA(UCHN)
3279:         XCTR    XW,[MOVEM TAC,(UUO)]
3280:         POPJ    P,
    UUOCON page# 0103 next  prev
3282: ;;THIS UUO GETS THE STANDARD BUFFER LENGTH FOR A DEVICE
3283: ;       MOVE AC,[DEVICE NAME IN SIXBIT]
3284: ;       CALL AC,[SIXBIT /BUFLEN/]
3285: ;       <RETURNS HERE WITH BUFFER LENGTH, OR 0, IN AC>
3286: 
3287: BUFLEN: PUSHJ P,FNDDDB          ; LOOK FOR DEVICE WITH THIS NAME (OR CHANNEL #)
3288:         JRST RTZERO             ; GIVE BACK A ZERO IF NOT FOUND
3289:         LDB TAC,PDVBLN          ; RETURN BUFFER LENGTH
3290:         JRST STOTAC
    UUOCON page# 0104 next  prev
3292: ; ROUTINE TO GET THE TIME CELLS AND CLEAR THEM
3293: ; CALLING . . .
3294: ;       MOVE AC,<ADDRESS OF 2-WORD BUFFER>
3295: ;       CALL AC,[SIXBIT /GDPTIM/]
3296: ; RETURNS KEYBOARD TIME IN <BUFFER> AND DISPLAY TIME IN <BUFFER>+1
3297: ; CLEARS BOTH CELLS IN THE MONITOR
3298: ; RETURNS ZEROS IF YOU ARE NOT A DPY
3299: 
3300: GDPTIM:
3301: REPEAT 0 < ;GDPTIM UUO REMOVED 23-MAR-73
3302:         MOVE    TAC1,JBTLIN(J)          ;GET OUR LINE NUMBER
3303:         XCTR    XR,[MOVE TAC,(UCHN)]    ;FIND WHERE TO STUFF DATA
3304:         SETZB   AC1,AC2                 ;ZERO A PAIR OF AC'S 
3305:         TLNE    TAC1,DISLIN!DDDLIN      ;SKIP IF NOT III OR DATA DISK
3306:         SKIPN   DDB,LETAB-DPYL0(TAC1)
3307:         JRST    NOTDPY                  ;NOT A DPY
3308:         EXCH    AC1,DPKTIM(DDB)         
3309:         EXCH    AC2,DPGTIM(DDB)
3310: NOTDPY: XCTR    XW,[MOVEM AC1,(TAC)]
3311:         XCTR    XW,[MOVEM AC2,1(TAC)]
3312: >;END DELETION OF GDPTIM
3313:         POPJ    P,
3314: 
    UUOCON page# 0105 next  prev
3316: ;;RETURNS A CODE TELING WHETHER A JOB NAME IS LOGGED IN
3317: ;       MOVE AC,[<JOB NAME IN SIXBIT>]
3318: ;       CALL AC,[SIXBIT /NAMEIN/]
3319: ;       <NO SUCH JOB - ERROR CODE IN AC>
3320: ;
3321: ; ERROR CODE IS 3 FOR MULTIPLY DEFINED JOB NAME, 1 FOR NO SUCH NAME
3322: 
3323: NAMEIN:
3324:         MOVEI TAC1,JOBN-1
3325: NAMEI1: CAME TAC,JOBNAM(TAC1)   ; IS THIS IT?
3326: NAMEI2: SOJG TAC1,NAMEI1
3327:         JUMPN TAC1,NAMEI4
3328:         MOVEI TAC,1
3329:         JRST STOTAC     ; NO SUCH NAME, GIVE ERROR 1 RETURN
3330: NAMEI4: MOVE AC1,JBTSTS(TAC1)
3331:         TLNN AC1,JNA            ; NOW, IS IT A JOB?
3332:         JRST NAMEI2
3333:         MOVE AC2,TAC1           ;GIVE BACK JOB NUMBER
3334: NAMEI3: SOJLE TAC1,NAMEI5       ; SEARCH REMAINDER OF NAMES FOR MATCH
3335:         CAME TAC,JOBNAM(TAC1)
3336:         JRST NAMEI3
3337:         MOVE AC1,JBTSTS(TAC1)
3338:         TLNN AC1,JNA
3339:         JRST NAMEI3
3340:         MOVEI TAC,3
3341:         JRST STOTAC
3342: NAMEI5: MOVE TAC,AC2
3343:         AOS (P)                 ; SKIP RETURN
3344:         JRST STOTAC             ; AND GIVE HIM THE JOB NUMBER
    UUOCON page# 0106 next  prev
3346: ; DEVUSE - HOW MANY JOBS ARE WAITING FOR A PARTICULAR DEVICE.
3347: ; CALLING . . .
3348: ;       MOVE AC,<DEVICE NAME>
3349: ;       CALL AC,[SIXBIT /DEVUSE/]
3350: ; RETURNS NUMBER OF JOBS WAITING FOR THIS DEVICE IN AC (NOT INCLUDING YOUR JOB)
3351: 
3352: DEVUSE: PUSHJ   P,FNDDDB        ; PICK UP DEVICE DATA BLOCK ADDRESS
3353:         JRST    RTZERO          ; NO SUCH DEVICE, NOBODY WAITING FOR IT!
3354:         MOVEI   AC1,JOBN-1      ; PREPARE TO SCAN JOB TABLES
3355:         SETZ    TAC,
3356: DEVUS1: CAME    DDB,JBTDVW(AC1) ; IS THIS THE DEVICE?
3357: DEVUS2: SOJG    AC1,DEVUS1      ; NO, LOOP AROUND
3358:         JUMPE   AC1,DEVUS3      ; RETURN ARGUMENT AND LEAVE
3359:         CAIN    AC1,(J)
3360:         JRST    DEVUS2          ; DON'T COUNT YOURSELF.
3361:         MOVE    AC2,JBTSTS(AC1) ; SEE IF THE JOB EXISTS
3362:         MOVM    AC3,JOBQUE(AC1) ; AND IF IT IS IN DEVICE WAIT
3363:         TLNE    AC2,JNA
3364:         CAIE    AC3,DWQ
3365:         JRST    DEVUS2
3366:         AOJA    TAC,DEVUS2      ; BUMP COUNT AND LOOP BACK
3367: 
3368: DEVUS3: MOVE    TAC1,DEVMOD(DDB)
3369:         TLNE    TAC1,DVUDP
3370:         JRST    DEVUS4          ;COMPLICATED FOR UDP
3371:         LDB     AC1,PJOBN       ;GET JOB NUMBER OF DEVICE OWNER
3372:         TLNE    TAC1,TTYATC
3373:         TRO     AC1,100000
3374:         TRNE    TAC1,ASSCON
3375:         TRO     AC1,400000
3376:         TRNE    TAC1,ASSPRG
3377:         TRO     AC1,200000
3378:         HRL     TAC,AC1
3379:         JRST    STOTAC
3380: 
3381: DEVUS4: LDB AC1,PUNIT           ;UDP, SCAN ALL DDBS FOR ASSCON, ASSPRG
3382:         MOVE AC2,DKDBML(AC1)    ;MODEL DDB FOR THIS UDP
3383:         MOVE AC3,DEVNAM(DDB)
3384: DEVUS5: HLR AC2,DEVSER(AC2)
3385:         CAME AC3,DEVNAM(AC2)
3386:         JRST DEVUS7             ;NO MORE DDBS
3387:         MOVE TAC1,DEVMOD(AC2)
3388:         TRNE TAC1,ASSCON
3389:         TLO AC2,400000
3390:         TRNE TAC1,ASSPRG
3391:         TLO AC2,200000
3392:         LDB AC1,[POINT 6,DEVCHR(AC2),5]
3393:         CAIE AC1,(J)            ;EXTRA BITS FOR UDP ONLY,
3394:         JRST DEVUS6             ;NAMELY ASSCON AND ASSPRG FOR YOUR OWN JOB
3395:         TRNE TAC1,ASSCON
3396:         TLO AC2,40000
3397:         TRNE TAC1,ASSPRG
3398:         TLO AC2,20000
3399:         JRST DEVUS5
3400: 
3401: DEVUS6: TRNE TAC1,ASSCON        ;AND SEPARATELY FOR OTHER JOBS
3402:         TLO AC2,10000
3403:         TRNE TAC1,ASSPRG
3404:         TLO AC2,4000
3405:         JRST DEVUS5
3406: 
3407: DEVUS7: LDB TAC1,PUNIT          ;GET UDP NUMBER
3408:         HLRZ AC1,AC2            ;FLAGS INTO AC1
3409:         TRO AC1,2000            ;THIS IS PRIVATE OWNERSHIP FLAG
3410:         SKIPGE UDPOWN-1(TAC1)   ;SKIP IF PRIVATE
3411:         TRZA AC1,2000           ;PUBLIC, TURN OFF PRIVATE FLAG
3412:         ADD AC1,UDPOWN-1(TAC1)  ;JOB NUMBER OF OWNER OR 0 FOR PUBLIC
3413:         HRL TAC,AC1
3414:         JRST STOTAC
    UUOCON page# 0107 next  prev
3416: ; JOBRD  UUO TO BLT DATA FROM SOME OTHER JOB'S CORE IMAGE TO YOURS.
3417: ; CALLING . . .
3418: ;       MOVEI AC,ADR
3419: ;       CALL AC,[SIXBIT /JOBRD/]
3420: ;       <ERROR - CODE IN ADR+1>
3421: ;
3422: ;ADR:   <JOB NAME OR NUMBER>
3423: ;       <XWD -NWDS,HISADR - OR ERROR CODE,
3424: ;               1 FOR NON-EX JOB NUMBER
3425: ;               2 FOR AMBIGUOUS JOB NAME
3426: ;               3 FOR NON-EX JOB NAME
3427: ;               4 FOR ADDRESS OUT OF BOUNDS
3428: ;               5 FOR JOB NOT LOGGED IN
3429: ;               6 FOR BLOCK TOO LARGE!>
3430: ;       <ADDRESS IN YOUR CORE IMAGE WHERE YOU WANT THE DATA>
3431: 
3432: JOBRD:  HRR     UUO,TAC         ; PUT DATA BLOCK ADDRESS IN UUO
3433:         SKIPE   AC1,JBTFS(J)    ; DOES HE HAVE ANY FREE STORAGE?
3434:         PUSHJ   P,FSGIVE        ; YES, RETURN IT
3435:         SETZM   JBTFS(J)
3436:         XCTR    XR,[HLRO TAC,1(UUO)]    ; PICK UP LENGTH OF TRANSFER
3437:         CAMGE   1,[-2000]       ; MORE THAN ONE K?
3438:         JRST    [MOVEI  AC1,6   ; YES, VERBOTEN
3439:                 JRST INTDR4]    ; BLOCK TOO LARGE --  RPH 4-14-73
3440:         XCTR    XR,[MOVE TAC,(UUO)]     ; PICK UP JOB NUMBER OR NAME
3441:         TDNE    TAC,[-100]      ; IS IT A NUMBER?
3442:         JRST    JOBRD1          ; NO, GO PARSE IT
3443:         JUMPLE  TAC,INTDR1      ; IF NON-EX JOB NUMBER, FLUSH HIM NOW
3444:         CAIL    TAC,JOBN
3445:         JRST    INTDR1
3446: JOBRD2: MOVE    AC1,JBTSTS(TAC) ; JOB NUMBER OK, SEE IF JOB EXISTS
3447:         TLNN    AC1,JNA
3448:         JRST    [MOVEI  AC1,5
3449:                 JRST    INTDR4] ; NO SUCH JOB
3450:         TLNE    AC1,SWP!SHF     ;IS OTHER GUY BEING SWUFFLED OR SCHWAPPED?
3451:         JRST    JOBRD3          ;YES, THIS IS HARDER
3452:         HLRZ    AC1,JBTADR(TAC) ; NOW DOES IT HAVE ENOUGH CORE?
3453:         XCTR    XR,[HRRZ AC2,1(UUO)]    ; PICK UP STARTING ADDRESS
3454:         MOVE    TAC1,AC2
3455:         ADD     TAC1,JBTADR(TAC)        ; RELOCATE THE ADDRESS
3456:         XCTR    XR,[HLRO AC3,1(UUO)]    ; AND WORD COUNT
3457:         MOVN    AC3,AC3
    UUOCON page# 0108 next  prev
3459: ; JOBRD - PICK UP ADDRESS OF LAST WORD, ADDRESS CHECK IT
3460: 
3461:         ADDI    AC3,(AC2)               ; THIS IS LAST WORD TO BE TRANSFERRED
3462:         SUBI    AC3,1
3463:         CAILE   AC3,(AC1)
3464:         JRST    JOBRD4
3465:         SUBI    AC3,(AC2)               ; GET BACK WORD COUNT-1
3466: JOBRD5: XCTR    XR,[HRRZ AC2,2(UUO)]    ; PICK UP ADDRESS IN HIS CORE
3467:         ADD     AC3,AC2                 ; AND END OF TRANSFER
3468:         HLRZ    AC1,PROG                ; PICK UP OUR PROTECTION
3469:         CAIG    AC2,(AC1)
3470:         CAILE   AC3,(AC1)
3471:         JRST    JOBRD6
3472:         ADDI    AC2,(PROG)              ; COMPUTE ABSOLUTE ADDRESS OF DESTINATION
3473:         ADDI    AC3,(PROG)              ; ABSOLUTE ADDRESS OF LAST WORD.
3474:         HRL     AC2,TAC1                ; PUT INTO BLT
3475:         BLT     AC2,(AC3)               ; DO THE TRANSFER
3476:         AOS     (P)                     ; INDICATE SUCCESS RETURN
3477:         SKIPN   AC1,JBTFS(J)            ; IS THERE ANY FREE STORAGE THERE?
3478:         POPJ    P,                      ; NO, LEAVE NOW
3479:         SETZM   JBTFS(J)                ; NOT ANY MORE
3480:         JRST    FSGIVE                  ; YES, RETURN IT
3481: 
3482: JOBRD6: SKIPN   AC1,JBTFS(J)            ; IF NO FREE STORAGE, GIVE ERROR MESSAGE
3483:         JRST    JOBRD4
3484:         SETZM   JBTFS(J)
3485:         PUSHJ   P,FSGIVE
3486: JOBRD4: MOVEI   AC1,4
3487:         JRST    INTDR4
3488: 
3489: JOBRD1: PUSHJ   P,GJOBN         ; GET JOB NUMBER FROM JOB NAME
3490:         JRST    INTDR2
3491:         JRST    INTDR3
3492:         JRST    JOBRD2
    UUOCON page# 0109 next  prev
3494: ; JOBRD - GET FREE STORAGE FOR DATA, PLANT CLOCK REQUEST TO DO TRANSFER
3495: 
3496: JOBRD3: XCTR    XR,[HLRO AC3,1(UUO)]    ; PICK UP WORD COUNT
3497:         MOVN    AC3,AC3
3498:         ADDI    AC3,1
3499:         PUSHJ   P,UFSGET                ; F.S. BLOCK IS MINIMUM OF 6 WORDS
3500:         HRL AC1,TAC                     ; STORE JOB TO READ IN JBTFS
3501:         MOVEM   AC1,JBTFS(J)            ; SAVE FREE STORAGE ADDRESS
3502:         MOVE DAT,J                      ; ARG IS JOB NUMBER
3503:         HRLI DAT,JOBRCK                 ; ROUTINE TO CALL
3504:         PUSHJ P,DPYTIM
3505:         XCTR    XR,[MOVE AC2,1(UUO)]
3506:         MOVEM   AC2,(AC1)
3507: JOBRDX: MOVNI   AC3,IOWQ                ; WAIT FOR IT ALL
3508:         MOVEM   AC3,JOBQUE(J)
3509:         PUSHJ   P,WSCHED                ; WAIT FOR GUYS TO FILL IT
3510:         SKIPN AC1,JBTFS(J)              ; BLOCK STILL THERE?
3511:         JRST JOBRD6                     ; NO, GIVE ILL ADDR ERROR
3512:         HRRZI   TAC1,1(AC1)             ; PICK UP ADDRRESS PLUS ONE
3513:         SKIPGE (AC1)                    ; DONE YET?
3514:         JRST JOBRDX                     ; NO, WAIT AGAIN
3515:         SKIPE   TAC,(AC1)               ; WAS THERE AN ERROR?
3516:         JRST    JOBRDY                  ; YES, RETURN CODE
3517:         XCTR    XR,[HLRO AC3,1(UUO)]
3518:         MOVN    AC3,AC3
3519:         SOJA    AC3,JOBRD5              ; GO DO BLT TO USER
3520: 
3521: JOBRDY: XCTR XW,[MOVEM TAC,1(UUO)]      ; STORE ERROR CODE
3522:         SETZM JBTFS(J)
3523:         JRST FSGIVE                     ; RETURN BLOCK
3524: 
3525: ;FREE STORAGE BLOCK LOCATIONS
3526: ;       BEFORE                  AFTER
3527: ;0      -WC,,MA TO READ         -1=ERROR, 0=SUCCESS
3528: ;1      RANDOM                  DATA TO END OF BLOCK
3529: ;2                                      .
    UUOCON page# 0110 next  prev
3531: ; JOBRD - WE GET HERE AT CLOCK LEVEL . . .
3532: 
3533: JOBRCK: HRRZ J,DAT              ;JOB # IS ARG
3534:         SKIPN TEM,JBTFS(J)      ; DID FREE STORAGE BLOCK GO AWAY?
3535:         POPJ P,                 ; YES, DISAPPEAR
3536:         HLRZ TAC,TEM            ;GET JOB # WE ARE READING
3537:         MOVE AC1,JBTSTS(TAC)
3538:         TLNN AC1,JNA            ; IS JOB STILL THERE?
3539:         JRST JOBRC3             ; NO, ERROR
3540:         TLNE AC1,SHF            ;IF SHUFFLING
3541:         JRST DPYTIM             ;JUST REPLANT CLOCK REQUEST
3542:         TLNE AC1,SWP            ;IF SWAPPED,
3543:         JRST JOBRCQ             ;BRING HIM IN
3544:         PUSHJ P,JRDBLT          ;DO BLT
3545:         JRST JOBRC2             ;NOW CONTINUE USER
3546: 
3547: JOBRCQ: MOVE J,TAC              ;TRANSFER CONTROL TO SWAP IN LIST
3548:         MOVSI TAC,JRDSNB
3549:         JRST SETSIN
3550: 
3551: ;CALL WITH TEM=FS BLOCK, TAC=JOB # WE ARE READING FROM
3552: JRDBLT: HRRZ AC2,(TEM)          ; PICK UP STARTING ADDRESS
3553:         HLRO AC3,(TEM)          ; AND WORD COUNT
3554:         MOVNS AC3
3555:         HLRZ AC1,JBTADR(TAC)
3556:         ADDI AC3,(AC2)
3557:         SUBI AC3,1
3558:         CAILE AC3,(AC1)
3559:         JRST JRDBL1
3560:         SUBI AC3,-1(AC2)        ; BACK UP TO JUST WORD COUNT - 1
3561:         ADD AC2,JBTADR(TAC)     ; RELOCATE
3562:         HRLI AC2,1(TEM)         ; PREPARE TO MOVE DATA
3563:         MOVSS AC2
3564:         ADD AC3,TEM             ; ADD IN FS ADDRESS
3565:         BLT AC2,(AC3)
3566:         SETZM (TEM)             ; CLEAR THE ERROR FLAG
3567:         POPJ P,
3568: 
3569: JRDBL1: MOVEI TAC,4
3570:         MOVEM TAC,(TEM)         ; FLAG ERROR
3571:         POPJ P,
3572: 
3573: ;ENTER HERE WITH TAC=JOB JUST SWAPPED IN, J=JOB # WHO WANTS TO READ HIM
3574: ;CALLED FROM FININ
3575: JRDWIN:PUSH P,TEM              ;FIRST SAVE SOME ACS
3576:         PUSH P,AC1
3577:         PUSH P,AC2
3578:         PUSH P,AC3
3579:         HRRZ TEM,JBTFS(J)
3580:         PUSHJ P,JRDBLT          ;DO BLT
3581:         PUSHJ P,JOBRC2          ;RESTART USER
3582: JRDLEV: POP P,AC3               ;NOW RESTORE ACS
3583:         POP P,AC2
3584:         POP P,AC1
3585:         POP P,TEM
3586:         POPJ P,
3587: 
3588: ;CALLED FROM FININ
3589: JRDLOS:PUSH P,TEM              ;FIRST SAVE SOME ACS
3590:         PUSH P,AC1
3591:         PUSH P,AC2
3592:         PUSH P,AC3
3593:         HRRZ TEM,JBTFS(J)       ; J IS JOB # OF JOB DOING JOBRD
3594:         PUSHJ P,JOBRC1          ; GIVE ADDR ERROR RETURN ON SWAP ERROR
3595:         JRST JRDLEV
3596: 
3597: ;DONE, RESTART USER
3598: JOBRC3: SKIPA TAC,[5]           ;NO JOB THERE
3599: JOBRC1: MOVEI TAC,4             ;ADDR ERROR
3600:         MOVEM TAC,(TEM)
3601: JOBRC2: MOVM AC3,JOBQUE(J)
3602:         CAIE AC3,IOWQ           ;IS HE WERE WE LEFT HIM?
3603:         JRST [  MOVE AC1,JBTFS(J);NO, GIVE BACK FS AND GO AWAY
3604:                 SETZM JBTFS(J)
3605:                 JRST FSGIVE]
3606:         MOVNI AC3,RUNQ
3607:         MOVEM AC3,JOBQUE(J)
3608:         JRST REQUE
    UUOCON page# 0111 next  prev
3610: ;TMPCOR UUO - BEHAVES AS DESCRIBED IN DEC MANUAL
3611: 
3612: TMPMAX←←400     ;MAX TOTAL SIZE OF ONE JOB'S TMPCOR FILES
3613: 
3614: ;FORMAT OF TMPCOR BLOCK
3615: TMPLNK←←0       ;DOUBLE LINK WORD
3616: TMPNAM←←1       ;NAME,,SIZE
3617: TMPPPN←←2       ;PPN (ALIAS) OF TMP FILE
3618: TMPDAT←←3       ;BEGINNING OF DATA
3619: 
3620: TMPCRD: XCTR XR,[HRRZ DSER,(TAC)]       ;TMPCOR TO OTHER JOB:
3621:         JUMPN DSER,.+2
3622:         MOVEI DSER,(J)
3623:         MOVEI TAC1,0
3624:         CAMLE DSER,JOBNM1
3625:         JRST TMPCR1
3626:         MOVE AC1,JBTSTS(DSER)
3627:         TLNN AC1,JNA
3628:         JRST TMPCR1                     ;NO SUCH JOB
3629:         XCTR XR,[SKIPN UUO,2(TAC)]      ;GET JOB, ALIAS FROM USER
3630:         MOVE UUO,PRJPRG(DSER)           ;DEFAULT IS HIS PPN
3631:         JRST TMPCO1
3632: 
3633: TMPCOR: MOVEI DSER,(J)                  ;TMPCOR TO YOURSELF:
3634:         SKIPN UUO,DSKPPN(DSER)          ;DSER IS YOUR JOB
3635:         MOVE UUO,PRJPRG(DSER)           ;UUO IS YOUR ALIAS
3636: TMPCO1: HLRZ TAC1,TAC
3637:         CAIL TAC1,NUMTMP
3638:         JRST UUOERR
3639:         CAIE DSER,(J)
3640:         SKIPGE TMPDSP(TAC1)             ;ONLY SOME ALLOWED FOR TMPCRD
3641:         JRST .+2
3642:         JRST UUOERR
3643:         PUSHJ P,@TMPDSP(TAC1)
3644:         JRST .+2
3645:         AOS (P)
3646: TMPCR1: XCTR XW,[MOVEM TAC1,(UCHN)]     ;STORE PARAM FROM TAC1 (OFTEN SIZE)
3647:         POPJ P,
3648: 
3649: TMPDSP: SETZ TMPSZ1                     ;4.9 IMPLIES ALLOWED FOR OTHER JOBS
3650:         SETZ TMPRED
3651:         TMPRDD
3652:         TMPWRT
3653:         SETZ TMPDIR
3654:         TMPCLR
3655: NUMTMP←←.-TMPDSP
3656: 
3657: ;CALCULATE AMT OF ROOM LEFT (TMPMAX-CURRENT TOTAL)
3658: TMPSZ1: AOSA (P)
3659: TMPWRX: PUSHJ P,FSGIVE          ;HERE IF XFER ABORTS AFTER GETTING FS
3660: TMPSIZ: MOVEI TAC1,TMPMAX
3661:         JSP DAT,TM1SCN          ;COUNT ALL FILES WITHOUT REGARD TO ALIAS
3662:          SUB TAC1,TMPNAM(AC1)
3663:          TLZA TAC1,-1
3664:         POPJ P,
3665: 
3666: ;SCAN A JOB'S TMPCOR FILES AND EXECUTE 2 INSTRS FOLLOWING CALL
3667: TMPSCN: HRRZ AC3,JBTTCR(DSER)
3668: TMPSC1: SKIPN AC1,AC3
3669:         JRST 2(DAT)
3670:         CAME UUO,TMPPPN(AC1)    ;IGNORE ALL TMP FILES WITH WRONG ALIAS
3671:         JRST TMPSC2
3672:         HRRZ AC3,TMPLNK(AC1)    ;SAVE LINK NOW IN CASE DELETING
3673:         XCT (DAT)
3674:         XCT 1(DAT)              ;THIS ONE USUALLY SKIPS
3675:         JRST 3(DAT)             ;BUT SKIP RETURN NOW IF NOT
3676:         JRST TMPSC1
3677: TMPSC2: HRRZ AC3,TMPLNK(AC1)
3678:         JRST TMPSC1
3679: 
3680: ;SCAN A JOB'S TMPCOR FILES AND EXECUTE 2 INSTRS FOLLOWING CALL--IGNORE ALIAS
3681: TM1SCN: HRRZ AC3,JBTTCR(DSER)
3682: TM1SC1: SKIPN AC1,AC3
3683:         JRST 2(DAT)
3684:         HRRZ AC3,TMPLNK(AC1)    ;SAVE LINK NOW IN CASE DELETING
3685:         XCT (DAT)
3686:         XCT 1(DAT)              ;THIS ONE USUALLY SKIPS
3687:         JRST 3(DAT)             ;BUT SKIP RETURN NOW IF NOT
3688:         JRST TM1SC1
3689: 
3690: ;FIND REQUESTED TMPCOR FILE
3691: TMPFND: XCTR XR,[HLLZ TAC1,(TAC)]
3692:         JSP DAT,TMPSCN
3693:          HLLZ AC2,TMPNAM(AC1)
3694:          CAMN AC2,TAC1
3695:         POPJ P,
3696:         JRST CPOPJ1
    UUOCON page# 0112 next  prev
3698: ;CHECK & RELOCATE TMPCOR WCMA
3699: TMPSET: MOVEI TAC1,-1           ;UPPER LIM ON WC
3700: TMPST1: XCTR XR,[HLRE AC2,1(TAC)]
3701:         JUMPGE AC2,CPOPJ
3702:         MOVN AC2,AC2            ;+ WC
3703:         CAILE TAC1,(AC2)        ;USE MIN OF FILE & USER WC'S
3704:         SKIPA TAC1,AC2
3705:         MOVEI AC2,(TAC1)
3706:         XCTR XR,[HRRZ AC3,1(TAC)]       ;START ADR-1
3707:         PUSH P,AC1
3708:         ADDI TAC1,(AC3)         ;CALCULATE END ADR
3709:         PUSHJ P,RELOCA          ;CHECK IT
3710:         JRST UUOERR
3711:         MOVEI TAC1,1(AC3)       ;START ADR
3712:         PUSHJ P,RELOCB          ;CHECK THAT TOO
3713:         JRST UUOERR
3714:         POP P,AC1
3715:         JRST CPOPJ1
3716: 
3717: ;READ TMPCOR FILE
3718: TMPRED: PUSHJ P,TMPFND          ;LOOK FOR FILE
3719:         JRST TMPSIZ             ;NOT THERE - RETURN FREE SIZE
3720:         HRRZ TAC1,TMPNAM(AC1)   ;LIMIT XFER TO SIZE
3721:         PUSHJ P,TMPST1
3722:         JRST TMPRDX
3723:         JUMPL TAC1,UUOERR       ;CAN'T CLOBBER WRITE PROTECTED CORE
3724:         HRLI TAC1,TMPDAT(AC1)
3725:         ADDI AC2,(TAC1)
3726:         BLT TAC1,-1(AC2)
3727: TMPRDX: HRRZ TAC1,TMPNAM(AC1)   ;RETURN ACTUAL FILE SIZE
3728:         JRST CPOPJ1
3729: 
3730: ;READ & DELETE TMPCOR FILE
3731: TMPRDD: PUSHJ P,TMPRED          ;TRY TO READ FILE
3732:         POPJ P,
3733:         AOSA (P)                ;SET SKIP & SKIP INTO TMPDEL
3734: 
3735: ;READ & CLEAR TMPCOR DIRECTORY
3736: TMPCLR: JSP TEM,TMPDR2          ;SET TEM TO CALL TMPDEL FOR EACH ITEM
3737: 
3738: ;DELETE TMPCOR FILE SPECIFIED BY (AC1)
3739: TMPDEL: MOVE AC2,TMPLNK(AC1)
3740:         TRNE AC2,-1
3741:         HLLM AC2,(AC2)
3742:         MOVS AC2,AC2
3743:         HLRM AC2,(AC2)
3744:         JRST FSGIVE
    UUOCON page# 0113 next  prev
3746: ;WRITE TMPCOR FILE
3747: TMPWRT: PUSHJ P,TMPFND  ;SEE IF IT ALREADY EXISTS
3748:         JRST .+2        ;NO
3749:         PUSHJ P,TMPDEL  ;YES - DELETE IT
3750:         PUSHJ P,TMPSET
3751:         JRST TMPSIZ     ;NO XFER
3752:         MOVSI DAT,(TAC1)        ;SAVE USER ADR
3753:         PUSHJ P,TMPSIZ
3754:         CAILE AC2,(TAC1)
3755:         POPJ P,                 ;NOT ENOUGH ROOM LEFT
3756:         MOVEI AC3,TMPDAT(AC2)
3757:         PUSHJ P,UFSGET          ;GET A BLOCK
3758:         PUSHJ P,TMPSET          ;NOW DO THIS AGAIN (MAY HAVE MOVED)
3759:         JRST TMPWRX
3760:         MOVSI DAT,(TAC1)        ;LH OF BLT PNTR
3761:         MOVSI TAC1,JBTTCR(DSER)
3762:         HRR TAC1,JBTTCR(DSER)   ;& LINK IT IN
3763:         MOVEM TAC1,TMPLNK(AC1)
3764:         HRRM AC1,JBTTCR(DSER)
3765:         HRLM AC1,(TAC1)
3766:         XCTR XR,[HLL AC2,(TAC)] ;GET NAME
3767:         MOVEM AC2,TMPNAM(AC1)   ;STORE NAME & SIZE
3768:         MOVEM UUO,TMPPPN(AC1)   ;AND ALIAS WITH TMP FILE
3769:         HRRI DAT,TMPDAT(AC1)    ;MAKE BLT PNTR
3770:         ADDI AC2,(DAT)          ;CALC END ADR
3771:         BLT DAT,-1(AC2)
3772:         JRST TMPSZ1             ;SKIP RETURN WITH NEW FREE CNT
3773: 
3774: ;READ TMPCOR DIRECTORY
3775: TMPDIR: MOVEI TEM,CPOPJ         ;NO DELETING
3776: TMPDR2: PUSHJ P,TMPSET
3777:         JFCL
3778:         JUMPL TAC1,UUOERR       ;ERR IF R/O CORE
3779:         MOVSI AC2,1(AC2)        ;BUGGER BY 1 FOR PRE-AOBJN
3780:         MOVN AC2,AC2
3781:         HRRI AC2,(TAC1)         ;MAKE AOBJN PNTR
3782:         MOVEI TAC1,             ;INIT CNT
3783:         JSP DAT,TMPSCN
3784:          PUSHJ P,TMPDR1
3785:          CAIA
3786:         JRST CPOPJ1
3787: 
3788: TMPDR1: MOVE TAC,TMPNAM(AC1)    ;GET NAME & SIZE
3789:         AOBJP AC2,.+2
3790:         MOVEM TAC,-1(AC2)       ;STORE IF ROOM
3791:         AOJA TAC1,(TEM)         ;COUNT ITEM & DO EXIT THING
3792: 
3793: ;DELETE ALL TMPCOR FILES (REGARDLESS OF ALIAS PPNS)
3794: TMPKIL: MOVEI DSER,(J)          ;THIS ROUTINE DOES OWN JOB!!
3795:         JSP DAT,TM1SCN          ;FIND ALL TMP FILES, IGNORING ALIAS
3796:          PUSHJ P,TMPDEL         ;DELETE EACH ONE
3797:          CAIA
3798:         POPJ P,
    UUOCON page# 0114 next  prev
3800: SUBTTL  UUOCON  IO SECTION
3801: ;FOR PURPOSES OF COMMENTING THIS SUBROUTINE THE
3802: ;TERM 'BUFFER HEADER' SHALL REFER TO THE 3 WORD HEADER
3803: ;WHICH IS USED BY THE USER PROGRAM AND THIS EXEC FOR
3804: ;REFERING TO THE RING BUFFERS.
3805: 
3806: ;THE CONTENTS OF THE 3 WORD HEADER (AS SET BY THE MONITOR
3807: ;               ON EACH INPUT AND OUTPUT UUO).
3808: ;               BIT 18-35=ADDRESS OF SECOND WORD OF THE
3809: ;               CURRENT BUFFER IN RING WHICH USER IS REFERENCING
3810: ;       WORD 2: BYTE POINTER TO CURRENT ITEM.
3811: ;       WORD 3: POSITIVE ITEM COUNT (NO. OF ITEMS LEFT ON
3812: ;               INPUT, NO. OF FREE ITEMS TO GO ON OUTPUT).
3813: 
3814: ;EACH BUFFER IN THE RING HAS FOLLOWING FORMAT (AS THE USER SEES IT)
3815: 
3816: ;       WORD 1: RESERVED FOR BLOCK NUMBER FOR FIXED ADDRESS DEVICES
3817: ;       WORD 2: BIT 0=USE BIT FOR THIS BUFFER
3818: ;               BIT 1-17=NO. OF WORDS WHICH FOLLOW (LENGTH OF BUFFER)/
3819: ;               BIT 18-35=ADDRESS OF SECOND WORD OF NEXT BUFFER IN RING
3820: ;       WORD 3: LH=LINK TO NEXT BLOCK (SET BY MONITOR FOR DECTAPE)
3821: ;               RH=NO. OF WORDS OF DATA WHICH FOLLOW (USUALLY
3822: ;               SET BY EXEC EXCEPT IF THE USER HAS SPECIFIED
3823: ;               THAT HE WANTS TO COMPUTE WORD COUNT
3824: ;               HIMSELF INSTEAD OF HAVING THE MONITOR DO IT
3825: ;               USING THE BYTE POINTER IN THE 3 WORD HEADER).
    UUOCON page# 0115 next  prev
3827: ;IOPUSH, IOPOP, IOPDL
3828: 
3829: ;IOPUSH CHN,ID
3830: ;       PUSH DEVICE ON CHANNEL "CHN" ON STACK WITH ID "ID"
3831: IOPUSH: SKIPE AC1,JBTIOP(J)
3832:         JRST IOPSH1
3833:         MOVEI AC3,IOPDLN
3834:         PUSHJ P,UFSGET
3835:         MOVEM AC1,JBTIOP(J)
3836: IOPSH1: HLRZ AC3,AC1
3837:         CAIN AC3,-IOPDLN
3838:         POPJ P,                 ;NO SPACE ERROR
3839:         SUBM AC1,AC3
3840:         CAMLE UCHN,USRHCU
3841:         TDZA DDB,DDB
3842:         MOVE DDB,USRJDA(UCHN)
3843:         MOVEM DDB,(AC3)
3844:         SETZM USRJDA(UCHN)
3845:         SKIPN TAC,USRHCU
3846:         JRST IOPSH2             ;USRHCU STAYS AT 0 EVEN IF NO CHANNELS OPEN
3847: IOPSH3: SKIPN USRJDA(TAC)
3848:         SOJG TAC,IOPSH3
3849:         MOVEM TAC,USRHCU
3850: IOPSH2: MOVEM UCHN,1(AC3)
3851:         HRLM UUO,1(AC3)         ;SAVE ID ON STACK WITH CHANNEL NUMBER
3852:         SUB AC1,[2,,0]
3853: IOPOP3: MOVEM AC1,JBTIOP(J)
3854:         JRST CPOPJ1
3855: 
3856: ;IOPOP CHN,ID
3857: ;       RELEASE DEVICE ON CHANNEL "CHN", POP DEVICE WITH ID "ID" INTO CHANNEL "CHN"
3858: IOPOP:  PUSHJ P,FIOPID          ;FIND ID WHICH USER SPECIFIED
3859:         POPJ P,                 ;NO STACK, OR NOT FOUND
3860: IOPOP0: SKIPE DDB,USRJDA(UCHN)  ;IS A DEVICE ALREADY ASSIGNED TO THIS CHAN?
3861:         CAMLE UCHN,USRHCU(PID)  ;YES, IS THIS CHAN. LE HIGHEST CHAN. FOR THIS USER?
3862:         JRST IOPOP2             ;NO, NO PREVIOUS DEVICE TO RELEASE
3863:         HRRZ DSER,DEVSER(DDB)
3864:         PUSH P,AC3              ;SAVE POINTER TO ENTRY WE WILL POP
3865:         PUSHJ P,RELEA0          ;RELEASE PREVIOUS DEVICE ON THIS CHAN.
3866:         POP P,AC3
3867: IOPOP2: MOVE DDB,(AC3)          ;THIS POINTS TO STACK ENTRY
3868:         MOVEM DDB,USRJDA(UCHN)  ;NEW DEV ON THIS CHANNEL
3869:         JUMPE DDB,IOPOP4        ;DON'T READJUST USRHCU IF POPPING A NULL CHANNEL
3870: IOPOP1: CAMG UCHN,USRHCU
3871:         JRST IOPOP4
3872:         AOS TAC,USRHCU
3873:         SETZM USRJDA(TAC)
3874:         JRST IOPOP1
3875: 
3876: IOPOP4: MOVE AC1,JBTIOP(J)
3877:         ADD AC1,[2,,0]
3878:         JUMPG AC1,IOPOP5
3879:         HLRE AC2,AC1
3880:         SUBM AC1,AC2
3881:         HRRZ AC3,AC3
3882:         CAIN AC3,(AC2)          ;ARE WE THE END ENTRY?
3883:         JRST IOPOP3             ;YES, SKIP BLT
3884:         HRLI AC3,2(AC3)         ;BLT DOWN ONE ENTRY
3885:         BLT AC3,-1(AC2)         ;LAST WORD OF LAST ENTRY
3886:         JRST IOPOP3
3887: 
3888: IOPOP5: SETZM JBTIOP(J)
3889:         AOS (P)
3890:         JRST FSGIVE
3891: 
3892: IOPDL:  CAIL UCHN,IOPDLL        ;LEGAL IOPDL FUNTION?
3893:         JRST UUOERR             ;NO
3894:         JRST @IOPDLD(UCHN)      ;DISPATCH
3895: 
3896: ;IOPDL 0,
3897: ;       RETURN ALL STACKED DEVICES TO WHERE THEY CAME FROM
3898: IOPDL0: SKIPL AC3,JBTIOP(J)
3899:         POPJ P,
3900:         HLRE AC1,AC3
3901:         SUB AC3,AC1
3902:         HRRZ UCHN,-1(AC3)       ;GET JUST CHANNEL NUMBER
3903:         TRZ UUO,-1              ;MAKE SURE WE GET TOP OF STACK
3904:         PUSHJ P,IOPOP
3905:         POPJ P,
3906:         JRST IOPDL
3907: 
3908: ;IOPDL 1,
3909: ;       RELEASE ALL STACKED DEVICES
3910: IOPDL1: SKIPL JBTIOP(J)
3911:         POPJ P,                 ;DONE
3912:         TRZ UUO,-1              ;DO IT TO TOP OF STACK
3913:         PUSHJ P,IOPDL2          ;RELEASE IT
3914:         POPJ P,                 ;FOO
3915:         JRST IOPDL1             ;LOOP TILL ALL GONE
3916: 
3917: ;IOPDL 2,ID
3918: ;       RELEASE STACKED DEVICE WITH ID "ID".
3919: IOPDL2: PUSHJ P,FIOPID
3920:         POPJ P,                 ;NOT FOUND
3921:         MOVE DDB,(AC3)          ;GET DEVICE HE WANTS RELEASED
3922:         EXCH DDB,USRJDA         ;EXCHANGE WITH CHAN 0
3923:         MOVEM DDB,(AC3)         ;WHICH WE SAVE ON STACK
3924:         SETZ UCHN,              ;NOW RELEASE CHANNEL 0 AND POP OLD ONE BACK THERE
3925:         JRST IOPOP0
3926: 
3927: IOPDLD: IOPDL0
3928:         IOPDL1
3929:         IOPDL2
3930: IOPDLL←←.-IOPDLD
3931: 
3932: FIOPID: SKIPL AC3,JBTIOP(J)     ;ANY STACK AT ALL?
3933:         POPJ P,                 ;NO
3934:         HLRE AC1,AC3
3935:         SUBI AC3,2(AC1)         ;POINT TO TOP OF STACK
3936:         MOVNI AC1,2(AC1)
3937:         HRL AC3,AC1             ;PUT COUNT IN LEFT HALF
3938:         TRNN UUO,-1             ;ANY ID?
3939:         JRST CPOPJ1             ;NO, 0 IS ALWAYS TOP OF STACK
3940: IOPID1: HLRZ AC1,1(AC3)         ;GET ID
3941:         CAIN AC1,(UUO)
3942:         JRST CPOPJ1             ;FOUND IT
3943:         SUB AC3,[2,,2]
3944:         JUMPG AC3,IOPID1        ;MORE TO GO?
3945:         POPJ P,                 ;NO, NOT FOUND
    UUOCON page# 0116 next  prev
3947: ; CLOSE UUO - CALLING SEQUENCE
3948: ;       CLOSE D,
3949: ;       EXIT            ALWAYS RETURNS HERE
3950: ; THIS ROUTINES PROCESSES THE CLOSE UUO AND DETERMINES WHETHER THE
3951: ;OUTPUT ROUTINE SHOULD BE CALLED IF OUTPUT WERE ACTIVE, CLEARS
3952: ;THE INPUT BUFFER AREA IF INPUT WERE ACTIVE, AND CLEARS THE 
3953: ;ITEM COUNTS OF BOTH INPUT AND OUTPUT HEADERS SERVING TO BOTH
3954: ;TERMINATE THE USE OF THE DEVICE AND SET THE I/O ROUTINES TO
3955: ;ACCEPT ANOTHER INPUT OR OUTPUT COMMAND IN A CLEAR STATE.
3956: ;IN THE CASE OF OUTPUT DEVICES, THE CLOSE ROUTINE OF THE DEVICE HANDL-
3957: ;ING ROUTINE IS CALLED IN CASE ANY SPECIAL HANDLING IS REQUIRED.
    UUOCON page# 0117 next  prev
3959: ; CLOSE CODE - WAIT FOR IO TO FINISH, FLUSH BUFFERS
3960: 
3961: CLOSE1:
3962:         PUSHJ PDP,WAIT1         ; WAIT UNTIL DEVICE IS INACTIVE
3963:         ANDCMI UUO,777774       ;ZERO ALL BUT CLOSE-INHIBIT BITS IN RH OF UUO
3964:         TRNN UUO,CLSIN          ;SUPPRESS INPUT CLOSE?
3965:         TLOE DEVDAT,ICLOSB      ;NO. INPUT ALREADY BEEN CLOSED?
3966:         JRST UCLS2              ;YES
3967:         LDB TAC,PIOMOD          ;NO
3968:         CAIN TAC,2
3969:         POPJ PDP,               ;SAVE MODE.
3970:         CAIGE TAC,SD            ;DUMP MODE?
3971:         JRST UCLSBI             ;NO. CLOSE BUFFERED INPUT.
3972: UCLS5:  PUSHJ PDP,DCLI(DSER)    ;YES. DISPATCH TO DEVICE DEP. ROUTINE
3973:         JRST UCLS2              ;MUST NOT DESTROY UUO,DEVDAT,DSER,UCHN
3974: UCLSBI: MOVE TAC,DEVMOD(DEVDAT)
3975:         TLNE DEVDAT,INBFB+INPB  ;WAS AN INPUT BUFFER SETUP?
3976:         JRST UCLS4              ;
3977:         TLNE TAC,DVDSK!DVIMP    ;NO.  CLOSING DISK OR IMP?
3978:         JRST UCLS5              ;YES. DO CLOSE
3979:         JRST UCLS2              ;NO.
3980: UCLS4:  TLNE TAC,DVLNG
3981:         PUSHJ PDP,DCLI(DSER)    ;YES, CLOSE INPUT
3982:         HRRZ TAC1,DEVBUF(DEVDAT)
3983:         XCTR    XR,[HRRZ DAT,(TAC1)]    ;PICK UP FIRST WORD OF BUFFER HEADER
3984:         LDB AC3,PDVBLN          ; PICK UP BUFFER LENGTH
3985:         ADDI AC3,(DAT)          ; ADD IN BUFFER ADDRESS
3986:         XCTR    XRW,[MOVES (AC3)]       ; ADDRESS CHECK BUFFER ADDRESS
3987:         XCTR    XR,[HRR TAC1,(TAC1)]    ; REMEMBER CURRENT BUFFER IN TAC1
3988:         HRLZI TAC,IOUSE         ;USED BOTH FOR HEADER AND EACH BUFFER
3989:         JUMPE DAT,UCLS1         ;HAS A RING BEEN SETUP?(NO IF 0)
3990:         SETZM AC1
3991:         LDB TEM,PDVBLN          ; FIGURE OUT THE MAXIMUM NUMBER OF BUFFERS
3992:         HLRZ AC3,PROG
3993:         IDIVI AC3,(TEM)
3994:         ADDI AC3,2              ; AND THIS IS CERTAINLY A GOOD UPPER BOUND!
3995: UCLS0:  XCTR    XR,[HRR DAT,(DAT)]      ; ADVANCE CURRENT INPUT BUFFER ADDRESS
3996:         CAIN AC1,(DAT)          ;IS THIS THE SAME BUFFER AS LAST ONE?
3997:         JRST UCLS1              ;YES. BAD RING. LOOPING ON ITSELF.
3998:         MOVEI AC1,(DAT)         ;IS ADDRESS OK?
3999:         XCTR    XRW,[ANDCAM TAC,(DAT)]; CLEAR USE BIT
4000:         SOJL AC3,UCLS1
4001:         CAME TAC1,DAT           ;DONE?
4002:         JRST UCLS0
    UUOCON page# 0118 next  prev
4004: ; CLOSE CODE
4005: 
4006: UCLS1:  HRRZ DAT,DEVBUF(DEVDAT)
4007:         XCTR XRW,[IORM TAC,(DAT)]       ; FLAG AS VIRGIN BUFFER IN HEADER
4008:         XCTR XW,[SETZM 2(DAT)]          ; CLEAR INPUT ITEM COUNT
4009:         MOVE IOS,[XWD IOEND,IODEND]
4010:         ANDCAB IOS,DEVIOS(DEVDAT)
4011: UCLS2:  TRNN UUO,CLSOUT         ;SUPPRESS OUTPUT CLOSE?
4012:         TLOE DEVDAT,OCLOSB      ;NO. OUTPUT ALREADY CLOSED?
4013:         JRST UCLS3              ;YES
4014:         LDB TAC,PIOMOD          ;NO.
4015:         CAIN TAC,2              ;SAVE MODE?
4016:         JRST UCLS3              ;YES.
4017:         CAIGE TAC,SD            ;DUMP MODE?
4018:         JRST UCLSBO             ;NO. CLOSE BUFFERED OUTPUT
4019: UCLS7:  PUSHJ PDP,DCL(DSER)     ;YES. DISPATCH TO DEVICE DEP. ROUTINE
4020:         JRST UCLS3
4021: UCLSBO: TLNN DEVDAT,OUTBFB+OUTPB        ;WAS AN OUTPUT BUFFER SET UP?
4022:         JRST UCLS6              ;NO
4023:         HLR DAT,DEVBUF(DEVDAT)  ; RESTORE DAT NOW.
4024:         XCTR XR,[SKIPG (DAT)]
4025:         JRST UCLS6              ; DO NOT CLOSE UNLESS DISK OR IMP
4026:         HLRZ AC1,PROG           ; PICK UP LENGTH OF LOWER
4027:         LDB AC2,PSEGN
4028:         HLRZ AC2,JBTADR(AC2)    ; AND ADD IN LENGTH OF UPPER
4029:         ADDI AC1,2(AC2)
4030:         LDB AC2,PDVBLN
4031:         ADDI AC2,2              ; PICK UP SIZE OF BUFFER
4032:         IDIVI AC1,(AC2)         ; GET MAXIMUM NUMBER OF BUFFERS HE COULD HAVE
4033:         PUSH P,AC1              ; AND SAVE IT
4034: UCLS2A: MOVE DSER,DEVSER(DEVDAT)
4035:         MOVE AC1,DEVOAD(DEVDAT)
4036:         SOSL (P)                ; DECREMENT MAXIMUM NUMBER OF BUFFERS WE WILL LOOK AT
4037:         XCTR    XR,[SKIPL (AC1)]        ; NO. HAS SERVICE ROUTINE WRITTEN
4038:                                 ;ITS NEXT BUFFER YET?
4039:         JRST UCLS2B             ;YES
4040:                                 ;NO. START OUTPUT DEVICE.
4041:         TRZ     IOS,760000
4042:         PUSH PDP,UUO            ; SAVE UUO
4043:         PUSHJ PDP,DOU(DSER)
4044:         POP PDP,UUO             ; RESTORE UUO
4045:         PUSHJ   PDP,WAIT1       ;WAIT TILL MOST BUFFERS FILLED
4046:         TRNN    IOS,760000      ;ERROR?
4047:         JRST UCLS2A             ;RETURN WHEN ALL EMPTIED
    UUOCON page# 0119 next  prev
4049: ; CLOSE - CALL DEVICE DEPENDENT ROUTINE
4050:                                 ;OF SHUFFLING REQUIRED STOPS DEVICE
4051: 
4052: UCLS2B: SUB P,[XWD 1,1]         ; NORMALIZE STACK, THROW AWAY MAXIMUM BUFFER COUNT
4053:         MOVE DSER,DEVSER(DEVDAT)
4054:         PUSHJ PDP,DCL(DSER)     ;CLOSE OUTPUT BUFFER
4055:         HLRZ DAT,DEVBUF(DEVDAT)
4056:         HRLZI TAC,IOUSE
4057:         XCTR XRW,[IORM TAC,(DAT)]
4058:         XCTR XW,[SETZM 2(DAT)]
4059:         PUSHJ PDP,WAIT1
4060:         TLO DEVDAT,OCLOSB       ;SET OCLOSB AFTER OUTPUT IS COMPLETE
4061: UCLS3:  HLLM DEVDAT,USRJDA(UCHN)
4062:         POPJ PDP,               ;EXIT THIS UUO
4063: 
4064: UCLS6:  MOVSI TAC,DVDSK!DVIMP   ;ALWAYS CALL DEVICE ROUTINE FOR DISK AND IMP
4065:         TDNE TAC,DEVMOD(DEVDAT)
4066:         JRST UCLS7
4067:         JRST UCLS3
    UUOCON page# 0120 next  prev
4069: ; INBUF - CALLING SEQUENCE
4070: ;       INBUF D,N
4071: ;       EXIT            RETURNS HERE IF MEMORY NOT EXCEEDED
4072: ;CALLING SEQUENCE
4073: ;       OUTBUF D,N
4074: ;       EXIT            RETURNS HERE IF MEMORY NOT EXCEEDED
4075: ; SETS UP AN N BUFFER RING FOLLOWING THE USER'S PROGRAM FOR DEVICE
4076: ; D AND INITIALIZES THE JOB BUFFER AREA HEADER:
4077: ;       JBFADR0:=1,     JBFADR 1-17:=0
4078: ;       JBFADR 18-35:=ADDRESS OF FIRST BUFFER IN RING
4079: ;INPUT SETS DEVIAD:=ADDRESS OF FIRST BUFFER IN RING
4080: ;OUTPUT SET DEVOAD:=ADDRESS OF FIRST BUFFER IN RING
4081: ;BUFPNT IS RESTORED.
    UUOCON page# 0121 next  prev
4083: ; SET UP BUFFERS OF USER-SPECIFIED LENGTH
4084: 
4085: UOUTBF:
4086:         TLNN DEVDAT,OBUFB       ; SEE IF THERE EXISTS AN OUTPUT BUFFER HEADER
4087:         JRST ILLOBF             ; NO HEADER, GIVE ERROR MESSAGE
4088:         TLO DEVDAT,OUTBFB       ; FLAG OUTBUF UUO DONE
4089:         PUSH PDP,BUFPNT         ;SAVE BUFPNT ON STACK
4090:         PUSHJ PDP,BUFCLC        ;SET UP BUFFER RING
4091: UOBF2:  HLR TAC,DEVBUF(DEVDAT)  ;TAC:=OUTPUT BUFFER AREA HEADER ADDRESS
4092:         HRRM BUFPNT,DEVOAD(DEVDAT)      ;DEVOAD:=ADDRESS OF FIRST BUFFER
4093:                                 ;IN RING
4094: UOBF1:  XCTR XW,[MOVEM BUFPNT,(TAC)]
4095:                                 ;JBFADR:=IOUSE,ADDRESS OF FIRST BUFFER
4096:                                 ;IN RING
4097:         LDB TAC,PUUOAC
4098:         MOVEM DEVDAT,USRJDA(TAC)
4099:         POP PDP,BUFPNT          ;RESTORE BUFPNT FROM STACK
4100:         POPJ PDP,               ;EXIT THIS UUO
4101: 
4102: UINBF:
4103:         TLNN DEVDAT,IBUFB       ; IS THERE AN INPUT BUFFER HEADER?
4104:         JRST ILLIBF             ; NO, ERROR
4105:         TLO DEVDAT,INBFB        ; FLAG INBUF UUO DONE
4106:         PUSH PDP,BUFPNT         ;SAVE BUFPNT ON STACK
4107:         PUSHJ PDP,BUFCLC        ;SET UP BUFFER RING
4108: UINBF1: HRRM BUFPNT,DEVIAD(DEVDAT)      ;DEVIAD:=ADDRESS OF FIRST BUFFER
4109:                                 ;IN RING
4110:         HRR TAC,DEVBUF(DEVDAT)  ;TAC:=INPUT BUFFER AREA HEADER ADDRESS
4111:         JRST UOBF1
    UUOCON page# 0122 next  prev
4113: ; UINBF - CALLING SEQUENCE . . .
4114: ;       UINBF D,ADR
4115: ; WHERE D IS CHANNEL NUMBER AND ADR IS ADDRESS OF TWO WORD BLOCK
4116: ; THE FIRST WORD OF WHICH IS THE NUMBER OF BUFFERS YOU WANT
4117: ; THE SECOND WORD IS THE LENGTH OF EACH BUFFER
4118: ; SAME FOR UOUTBF.
4119: 
4120: MINBF:  PUSHJ PDP,CHNSET        ; GIVE ERROR IF IO TO UNASSIGNED CHANNEL
4121:            JFCL
4122:            JRST CHNERR
4123:         TLNN DEVDAT,IBUFB       ; IS THERE A BUFFER HEADER ADDRESS?
4124:         JRST ILLIBF             ; NO, GO COMPLAIN
4125:         TLO DEVDAT,INBFB
4126:         PUSH PDP,BUFPNT
4127:         PUSHJ PDP,MBFSET        ; DO ALL THE DIRTY
4128:         JRST UINBF1
4129: 
4130: CHNERR: PUSHACS
4131:         PUSHJ P,DISDATE
4132:         PUSHJ P,DISERR
4133:         [ASCIZ/IO TO UNASSIGNED CHANNEL AFTER UUO LEVEL CHECK.
4134: CALLED FROM MINFB OR MOUTBF. J=/]
4135:         DISARG(DCP,<-20+J(P)>)
4136:         [ASCIZ/  UUO=/]
4137:         DISARG(OCT,<-21+UUO(P)>)
4138:         [ASCIZ/
4139: /]
4140:         -1
4141:         POPACS
4142:         JSP DAT,UERROR
4143: 
4144: MOUTBF: PUSHJ PDP,CHNSET
4145:            JFCL
4146:            JRST CHNERR
4147:         TLNN DEVDAT,OBUFB
4148:         JRST ILLOBF
4149:         TLO DEVDAT,OUTBFB
4150:         PUSH PDP,BUFPNT
4151:         PUSHJ PDP,MBFSET
4152:         JRST UOBF2
4153: 
4154: MBFSET: MOVE AC1,UUO
4155:         XCTR    XR,[HRR UUO,(AC1)]              ;MAKE UUO LOOK LIKE NORMAL INBUF
4156:         XCTR    XR,[MOVM TAC,1(AC1)]    ;AND PICK UP BUFFER LENGTH
4157:         JRST    BUFCLM                  ;NOW CLEAR OUT THAT MANY BUFFERS THAT BIG
    UUOCON page# 0123 next  prev
4159: ;;ERROR MESSAGES FOR INBUF, OUTBUF, UINBF, AND UOUTBF UUOS
4160: 
4161: ILLOBF: JSP TAC,ERRPTU          ; PRINT A BIT, SET UP TTY DEVDAT
4162:         ASCIZ /OUTPUT /
4163:         PUSHJ PDP,ERNAM         ; PRINT "DEVICE XXX"
4164:         JSP TAC,UUOMES          ; PRINT MESSAGE AND STOP JOB
4165:         ASCIZ / HAS NO OUTPUT BUFFER HEADER, UUO/
4166: 
4167: ILLIBF: JSP TAC,ERRPTU  ; SET UP FOR ERROR PRINTOUT
4168:         ASCIZ /INPUT /
4169:         PUSHJ PDP,ERNAM         ; PRINT "DEVICE XXX"
4170:         JSP TAC,UUOMES
4171:         ASCIZ / HAS NO INPUT BUFFER HEADER, UUO/
    UUOCON page# 0124 next  prev
4173: ;OPEN UUO - PERFORMS SAME OPERATION AS INIT
4174: ;MAY BE USED EASILY BY REENTRANT PROGRAMS
4175: ;CALLING SEQUENCE FROM USER AREA
4176: ;       OPEN D,ADR
4177: ;       ERROR RETURN
4178: ;       DEVICE INITED
4179: 
4180: ;LH(ADR)=0,RH(ADR)=DATA MODE THIS INIT
4181: ;LH(ADR+1)=OUTPUT BUFFER HEADER ADDRESS
4182: ;RH(ADR+1)=INPUT BUFFER HEADER ADDRESS
4183: ;C(ADR+2,...,ADR+5)=SAME AS LOOKUP OR ENTER
4184: 
4185: 
4186: UOPEN: XCTR    XR,[SKIP 2(UUO)]        ; ADDRESS CHECK GOODIE TABLE
4187:         MOVEI   DAT,1(UUO)      ;SETUP REL ADR OF ARGUMENTS
4188:         XCTR    XR,[HRR UUO,(UUO)]      ;SET UP RH WITH DATA MODE TO LOOK LIKE INIT
4189:         JRST    UINIT0
    UUOCON page# 0125 next  prev
4191: ; INIT - CALLING SEQUENCE
4192: ;       INIT D,MODUS    D=JOB DEVICE CHANNEL
4193: ;                       MODUS=IORDEL,IOCON,IOWC,MODE.
4194: ;       SIXBIT/NAME/    DEVICE NAME
4195: ;       XWD OBUF,IBUF   BUFFER AREA HEADER ADDRESSES
4196: ;       EXIT1           DEVICE NOT AVAILABLE
4197: ;       EXIT2           DEVICE PROPERLY ASSIGNED
4198: ;THE LEFT HALF OF NAME CONTAINS THE THREE LETTER DEVICE MNEMONIC,
4199: ;   THE RIGHT HALF IS EITHER ZERO (SYSTEM WILL ASSIGN AN ARBITRARY
4200: ;   UNIT) OR NON-ZERO TO REQUEST A SPECIFIC UNIT (LEFT JUSTIFIED).
4201: ;IF THE SELECTED DEVICE IS NOT AVAILABLE, CONTROL RETURNS TO EXIT1.
4202: ;OTHERWISE, THE DEVICE IS ASSIGNED TO THE USER AND ATTACHED TO HIS
4203: ;CHANNEL D.  THE DEVICE IS INITIALIZED IN THE FOLLOWING MANNER AFTER
4204: ;IOACT IS ZERO:
4205: ;       IOBEG:=1
4206: ;       DATA MODE:=BITS 32-35 OF AC UUO
4207: ;       IOCON:=BIT 31 OF AC UUO
4208: ;       IOWC:=BIT 30 OF AC UUO
4209: ;       IORDEL:=BIT 29 OF AC UUO
4210: ;       IOACT:=IODEND:=IOBKTL:=IODTER:=IODERR:=IOIMPM:=0
4211: ;       JBFADR:=JBFCTR:=0 FOR THE SPECIFIED BUFFERS.
4212: ;       DEVBUF:=OBUF,IBUF
    UUOCON page# 0126 next  prev
4214: ; INIT CODE - FIRST FIND DEVICE AND TRY TO ASSIGN IT
4215: 
4216: UINIT: MOVE DAT,UUOPC(ITEM)    ;SETUP DAT WITH REL ADR OF ARGUMENTS TO INIT
4217:         PUSHJ P,UINIT0          ;DO THE INIT
4218:         JRST .+2                ;NOW SET UP KLUDGEY MULTIPLE SKIP RETURN
4219:         AOS UUOPC(ITEM)         ;(ONLY AFTER ALL THRU WAITING, ETC.)
4220:         AOS UUOPC(ITEM)
4221:         JRST CPOPJ1             ;RETURN WITH ONE MORE SKIP
4222: 
4223: UINIT0: PUSH PDP,DAT            ; NOW SAVE POINTER TO ARGUEMENT LIST
4224: UINITG: SKIPE DEVDAT,USRJDA(UCHN)       ;IS A DEVICE ALREADY ASSIGNED TO THIS CHAN>?
4225:         CAMLE UCHN,USRHCU(PID)  ;YES, IS THIS CHAN. LESS OR EQUAL TO HIGHEST
4226:                                 ;CHAN. FOR THIS USER?
4227:         JRST UINITA             ;NO, NO PREVIOUS DEVICE TO RELEASE
4228:         PUSH PDP,UUO            ;SAVE UUO
4229:         PUSH PDP,DAT            ;SAVE POINTER TO ARGS.
4230:         PUSHJ PDP,RELEA0        ;RELEASE PREVIOUS DEVICE ON THIS CHAN.
4231:         POP PDP,DAT             ;RESTORE REL. ADR. OF ARGS.
4232:         POP PDP,UUO             ;RESTORE UUO
4233: UINITA: XCTR XR,[MOVE TAC,(DAT)]        ;GET DEVICE NAME FROM USER
4234: UINITK: MOVE J,JOB(PID)         ;JOB NUMBER
4235:         PUSHJ P,DEVSRC          ;SEARCH FOR DEVICE NAME
4236:                                 ;(SET SYSDEV BIT IN LH OF
4237:                                 ;DEVDAT IF THIS IS SYSTEM TAPE)
4238:         JRST UINXIT             ; MUST POP DAT OFF THE STACK BEFORE LEAVING
4239:         MOVE AC1,DEVCMR(DDB)
4240:         TLNE AC1,DEVMAS         ;SKIP IF OK TO INIT WITHOUT HAVING ASSIGNED OR INITED
4241:         JRST UNITAC             ;CHECK IF ASSIGNED
4242: UNITAD: MOVE TAC,DEVNAM(DDB)    ;PHYSICAL DEVICE NAME
4243:         CAME TAC,[SIXBIT /DSK/] ;NOT DISK?
4244:         CAME TAC,SYSTAP         ;SYSTEM TAPE DEVICE?
4245:         JRST UINITB             ;NO, DISK OR NOT SYSTEM TAPE
4246:         AOSE STREQ              ;SYSTEM TAPE, INCREMENT REQUEST COUNT
4247:         PUSHJ PDP,STWAIT        ;SYSTEM TAPE BUSY, PUT JOB IN WAIT
4248:         MOVEM ITEM,STUSER       ;SET THIS JOB AS ONLY USER OF SYSTEM TAPE
4249:                                 ;CONTROL C DOES NOT STOP JOB WHILE USING S. T.
4250: UINITB:
4251:         MOVEI TAC1,ASSPRG       ;TRY TO ASSIGN IT BY PROGRAM
4252:         PUSHJ PDP,ASSASG
4253:         JRST UINITW             ;NOT AVAILABLE, SEE IF HE WILL WAIT FOR IT
4254:         PUSHJ P,SETMOD          ;SET DDB IOS STATUS WORD
4255:         JRST UINITR             ;LOSE. ILLEGAL MODE.
4256:         MOVSI IOS,IOBEG         ;FLAG INIT JUST DONE
4257:         IORB IOS,DEVIOS(DEVDAT)
4258:                                 ;FROM RT. HALF OF UUO
4259:         MOVE TAC,DEVMOD(DDB)    ;GET GOOD BITS
4260:         TLNE TAC,DVTTY          ;IS IT A TTY?
4261:         TLNE TAC,TTYATC         ;AND NOT HIS CONSOLE?
4262:         JRST UINITL             ;NO
4263:         MOVSI IOS,TPMON
4264:         ANDCAB IOS,DEVIOS(DDB)  ;THEN NOT IN MONITOR MODE ANY MORE
4265: UINITL: SKIPGE USRHCU(PID)      ; IS USRHCU SCREWED UP?(NEGATIVE?)
4266:         SETZM USRHCU(PID)       ; YES, ZERO IT
4267: UINITM: CAMG UCHN,USRHCU(PID)   ; IS THIS CHANN. > HIGHEST CHANN. IN USE?
4268:         JRST UINITC             ;NO
4269:         AOS TAC,USRHCU(PID)     ;YES, BUMP HIGHEST SO FAR BY ONE
4270:         SETZM USRJDA(TAC)       ;AND CLEAR IT OUT
4271:         JRST UINITM             ;AND KEEP LOOKING
4272: 
4273: UNITAC: PUSH P,DDB              ;SAVE MODEL DDB
4274: UNTAC1: LDB AC1,PJOBN           ;CHECK FOR ASSIGNED OR INITED ALREADY
4275:         CAIN AC1,(J)
4276:         JRST UNTAD1             ;SAME JOB MEANS ASSIGNED OR INITED
4277:         PUSHJ P,DEVLP2          ;COME, LET US CONTINUE OUR SEARCH
4278:         CAIA
4279:         JRST UNTAC1             ;GOT ANOTHER, KEEP CHECKING
4280:         POP P,DDB
4281:         JSP TAC,ERRPTU          ;RAN OUT, HE LOSES
4282:         ASCIZ /MUST ASSIGN /
4283:         PUSHJ P,ERNAM           ;TYPE "DEVICE MUMBLE"
4284:         JRST EXCALP             ;AT USER/EXEC XXX
4285: 
4286: UNTAD1: POP P,(P)
4287:         JRST UNITAD
4288: 
4289: ; INIT - SET UP BUFFERS AND INITIALIZE THEM
4290: 
4291: UINITC: POP PDP,DAT             ;RESTORE POINTER TO ARGUMENT LIST
4292:         TLO DEVDAT,INITB        ;SET INIT UUO BIT
4293:         XCTR XR,[HLRZ TAC1,1(DAT)]      ;OUTPUT BUFFER HEADER FROM USER
4294:         JUMPE TAC1,UINIT4       ;WAS ONE SPECIFIED?
4295:         HRLM TAC1,DEVBUF(DEVDAT);YES, SET DEVICE DATA BLOCK
4296:         TLO DEVDAT,OBUFB        ;SET OUTPUT BUFFER SPECIFIED BIT
4297:         PUSHJ PDP,UINITZ        ;INITIALIZE OUTPUT BUFFER HEADER
4298: UINIT4: XCTR XR,[HRRZ TAC1,1(DAT)]      ;INPUT BUFFER HEADER FROM USER
4299:         JUMPE TAC1,UINIT5       ;WAS ONE SPECIFIED?
4300:         HRRM TAC1,DEVBUF(DEVDAT);YES, SET DEVICE DATA BLOCK
4301:         TLO DEVDAT,IBUFB        ;SET INPUT BUFFER SPECIFIED BIT
4302:         MOVSI IOS,IOEND         ;CLEAR END OF FILE FLAG
4303:         ANDCAB IOS,DEVIOS(DEVDAT);AND RETAIN IOS
4304:         PUSHJ PDP,UINITZ        ;INITIALIZE INPUT BUFFER HEADER
4305: UINIT5: MOVEM DEVDAT,USRJDA(UCHN);STORE UUO BITS AND  DEVICE
4306:                                 ;DATA BLOCK ADDRESS
4307:         JRST CPOPJ1             ;SUCCESSFUL RETURN
4308: 
4309: UINXIT: POP     P,DAT           ; RESTORE STACK LOSER EXIT.
4310:         POPJ    P,
4311: 
4312: UINITR: PUSH    P,DDB           ;SAVE LOSER DDB
4313:         JSP     TAC,ERRPTU
4314:         ASCIZ   /ILLEGAL DATA MODE FOR /
4315:         PUSHJ   P,ERNAM
4316:         EXCH    DDB,(P)         ;SAVE TTY DDB, GET LOSER DDB
4317:         PUSHJ   P,RELEA7        ;RELEASE DEVICE.
4318:         POP     P,DDB           ;RESTORE TTY DDB
4319:         JRST    EXCALP          ;SEND THE BEDBUG LETTER
    UUOCON page# 0127 next  prev
4321: ; HERE WE ASK HIM IF HE IS WILLING TO WAIT FOR THE DEVICE
4322: ; PUT HIM IN DEVICE WAIT (DWQ) IF HE WANTS TO WAIT
4323: ; ROUTINE TO WAIT FOR DEVICE TO BECOME AVAILABLE FOR INIT
4324: 
4325: UINITW: TRNE    UUO,400                 ;DOES HE WANT ERROR RETURN?
4326:         JRST    UINXIT                  ;YES. GIVE IT NOW
4327:         MOVE    TAC1,JBTPRV(J)
4328:         TLNE    TAC1,LUPPRV             ;LOCAL-USER?
4329:         JRST    UINTW1                  ;YES BYPASS TEST FOR SPECIAL DEV
4330:         MOVE    TAC1,DEVCMR(DDB)
4331:         TLNE    TAC1,DEVLUP
4332:         JRST    UINXIT
4333: UINTW1: HRRZM DDB,JBTDVW(J)     ; SAVE THE DEVICE DATA BLOCK ADDRESS
4334:         PUSH P,UUO
4335:         PUSH P,UUOPC(J)
4336:         PUSH P,UCHN
4337:         TRNE UUO,IOPAR          ; DO WE ASK HIM?
4338:         JRST SETWAT             ; NO, WAIT AUTOMATICALLY
4339: SETIWT: PUSHJ P,TTYFUW          ; WAIT FOR OUTPUT, SET UP DAT AND DDB
4340:         HRRZ TAC1,JBTDVW(J)
4341:         MOVE TAC1,DEVNAM(TAC1)
4342:         PUSHJ P,PRNAME
4343:         PUSHJ P,TYPGO
4344:         TYPE { IS BUSY, WILL YOU WAIT?}
4345:         PUSHJ P,UCTEXT
4346:         HRRZ DDB,JBTDVW(J)      ; PICK UP DDB ADDRESS OF DESIRED DEVICE
4347:         MOVE TAC,[XWD TTYATC,ASSCON!ASSPRG]
4348:         TDNE TAC,DEVMOD(DDB)    ; THE AND OF THESE FOR TTY
4349:         JRST SETRC
4350:         LDB TEM,PJOBN           ; PICK UP JOB NUMBER
4351:         JUMPE TEM,GOTIT         ; NOT CLAIMED, WE CAN GET IT
4352: SETRC:  CAME TAC1,[SIXBIT /Y/]
4353:         CAMN TAC1,[SIXBIT /YES/]
4354:         CAIA
4355:         JRST SETNOW
4356: SETWAT: MOVEI TAC1,DWQ
4357:         MOVNM TAC1,JOBQUE(J)
4358:         PUSHJ P,WSCHED
4359:         HRRZ    DDB,JBTDVW(J)
4360:         MOVE    TAC,[XWD TTYATC,ASSCON+ASSPRG]
4361:         TDNE    TAC,DEVMOD(DDB)
4362:         JRST    SETWAT          ;LOSE
4363:         LDB     TEM,PJOBN
4364:         JUMPE   TEM,GOTIT
4365:         CAIE    TEM,(J)
4366:         JRST    SETWAT
4367: GOTIT:  TYPE {GOTCHA!}
4368:         POP P,UCHN
4369:         POP P,UUOPC(J)
4370:         POP P,UUO
4371:         MOVE DAT,(P)
4372:         JRST UINITG
    UUOCON page# 0128 next  prev
4374: ; DEVICE WAIT - CAN'T GET IT, SEE IF HE WANTS DISK
4375: 
4376: SETNOW: TYPE {DIRECT IO TO DISK?}
4377:         PUSHJ P,UCTEXT
4378:         JUMPN TAC1,SETERY
4379: SETERX: POP P,UCHN
4380:         POP P,UUOPC(J)
4381:         POP P,UUO
4382:         HRRZ DDB,JBTDVW(J)      ;IN CASE WE NEED THIS ANYWAY (FOR ERR PRINT)
4383:         JRST UINXIT
4384: SETERY: CAME TAC1,[SIXBIT /Y/]
4385:         CAMN TAC1,[SIXBIT /YES/]
4386:         CAIA
4387:         JRST SETERX
4388:         MOVSI TAC,'DSK'
4389:         POP P,UCHN
4390:         POP P,UUOPC(J)
4391:         POP P,UUO
4392:         JRST UINITK
4393: 
4394: UCTEXT:
4395:         INCHWL JOBTM5           ; INPUT A CHARACTER WHICH WE WILL THROW AWAY!
4396:         MOVEI DAT,TTIBUF(DDB)   ; SET UP ADDRESS OF DATA BUFFER
4397:         PUSHJ P,CTEXT1
4398:         PUSHJ P,SKPBRK          ; MOVE OUT TO END OF LINE
4399:         POPJ P,
    UUOCON page# 0129 next  prev
4401: ;CALLING SEQUENCE
4402: ;       PUSHJ PDP,UINITZ
4403: ;       EXIT            RETURNS HERE IF MEMORY NOT EXCEEDED.
4404: ;SETS JBFADR:=JBFCTR:=0 FOR THE BUFFER AREA HEADER WHOSE ADDRESS
4405: ;IS IN AC TAC1.  ALSO,JBFPTR 0-5:=JBFPTR 12-17:=0,JBFPTR 6-11:=BYTE SIZE
4406: 
4407: 
4408: UINITZ: XCTR    XW,[SETZM (TAC1)]       ; CLEAR FIRST WORD OF BUFFER HEADER
4409:         XCTR    XW,[SETZM 2(TAC1)]      ; AND LAST WORD OF BUFFER HEADER
4410:         PUSH    P,TAC1
4411:         PUSHJ   P,SETBYT        ; SET BYTE SIZE ACCORDING TO MODE
4412:         TLZ     TAC,770077
4413:         POP     P,TAC1
4414:         XCTR    XRW,[HLLM TAC,1(TAC1)]
4415:         POPJ    P,              ;RETURN
    UUOCON page# 0130 next  prev
4417: ;LONG DISPATCH TABLE UUOS - GET HERE ONLY IF DEVICE HAS LONG
4418: ;DISPACTH TABLE
4419: ;DISPACTH TO DEVICE DEPENDENT SERVICE ROUTINE
4420: ;ENTER UUO - ENTER FILE NAME IN DIRECTORY
4421: 
4422: 
4423: 
4424: UDEN:   MOVEI TAC,CLSIN
4425:         TLNN DDB,ENTRB          ; HAS THIS FILE BEEN OPENED FOR WRITING?
4426:         JRST UDEN1              ; NO, SUPRESS CALL ON CLOSE CODE
4427:         TLNN DEVDAT,OCLOSB      ;FILE OPEN?
4428:         PUSHJ PDP,UDLKC         ;YES. CLOSE IT.
4429: UDEN1:  TLO IOS,IOBEG
4430:         TRZ IOS,776000
4431:         MOVEM IOS,DEVIOS(DEVDAT)
4432:         TLO DEVDAT,ENTRB
4433:         TLZ DEVDAT,OCLOSB
4434:         HLLM DEVDAT,USRJDA(UCHN)        ;STORE UUO BITS
4435:         JRST DEN(DSER)
4436: 
4437: ;LOOKUP UUO - LOOKUP FILE NAME IN DIRECTORY
4438: 
4439: 
4440: 
4441: UDLK:   MOVEI TAC,CLSOUT
4442:         TLNN DEVDAT,ICLOSB      ;FILE OPEN?
4443:         PUSHJ PDP,UDLKC         ;YES. CLOSE IT
4444:         TDZ IOS,[XWD IOEND,776000]
4445:         MOVEM IOS,DEVIOS(DEVDAT)
4446:         TLO DEVDAT,LOOKB
4447:         TLZ DEVDAT,ICLOSB
4448:         HLLM DEVDAT,USRJDA(UCHN)        ;STORE UUO BITS
4449:         JRST DLK(DSER)
4450: 
4451: 
4452: UDLKC: PUSH PDP,UUO
4453:         HRRI    UUO,(TAC)
4454:         PUSHJ PDP,CLOSE1
4455:         POP PDP,UUO
4456:         JRST    WAIT1
    UUOCON page# 0131 next  prev
4458: ;RENAME UUO - HERE ON SHORT DISPATCH TABLE DEVICES TOO
4459: 
4460: 
4461: 
4462: URENAM: MOVE TAC,DEVMOD(DEVDAT) ;IS THIS DEVICE A LONG DISPATCH TABLE?
4463:         TLNE TAC,DVLNG
4464:         JRST DRN(DSER)          ;YES, DISPATCH TO SERVICE ROUT.
4465:         JRST CPOPJ1             ;NO. GIVE SKIP RETURN TO USER
4466: 
4467: ;SETO UUO - SET NEXT OUTPUT BLOCK NUMBER(DECTAPE)
4468: 
4469: UDSO:   JRST DSO(DSER)
4470: 
4471: ;SETI UUO - SET NEXT INPUT BLOCK NUMBER
4472: 
4473: UDSI:   JRST DSI(DSER)
4474: 
4475: ;GETF UUO - GET NEXT FREE BLOCK
4476: 
4477: UDGF:   JRST DGF(DSER)
4478: 
4479: ;MTAPE UUO - MAGTAPE OPERATIONS
4480: 
4481: UMTAPE: JRST DMT(DSER)
4482: 
4483: ;UTPCLR - CLEAR DECTAPE DIRECT.
4484: 
4485: UTPCLR: MOVE TAC,DEVMOD(DEVDAT) ;IS THIS A LONG DISPATCH TABLE?
4486:         TLNN TAC,DVLNG
4487:         POPJ PDP,               ;NO,RETURN
4488:         JRST DCLR(DSER)         ;YES, DISPATCH
    UUOCON page# 0132 next  prev
4490: ;INPUT UUO
4491: 
4492: ;1)  IF OUTPUT ACTIVE ON THIS CHANNEL, WAIT FOR IT TO COMPLETE.
4493: ;2)  IF DUMP MODE, WAIT FOR DEVICE INACTIVE, CALL SERVICE
4494: ;       ROUTINE TO START INPUT, WAIT TILL COMPLETE, THEN RETURN TO USER.
4495: ;3)  IF NO BUFFER RING SETUP, SET UP 2 RING BUFFER.
4496: ;4)  IF FIRST REFERENCE, START SERVICE ROUTINE, GO TO
4497: ;5)  FLAG CURRENT BUFFER AS FREE TO RECEIVE MORE INPUT
4498: ;       (USE BIT SET TO 0).
4499: ;       START SERVICE ROUTINE FILLING FIRST BUFFER WITH USE BIT 0
4500: ;       (NEXT BUFFER OR ONE AHEAD OF IT)
4501: ;       (SERVICE ROUTINE WILL SET USE BIT WHEN IT FINISHES FILLING
4502: ;       BUFFER).
4503: ;7)  IF NEXT INPUT BUFFER IS FULL OF DATA, GO TO 10).
4504: ;8)  PUT JOB IN IO WAIT TILL NEXT BUFFER FILLED.
4505: ;9)  IF NEXT INPUT BUFFER STILL NOT FILLED, CHECK FOR END
4506: ;       OF FILE OR ERROR BITS SET BY SERVICE ROUTINE.
4507: ;10) CONVERT WORD COUNT AS STORED BY SERVICE ROUTINE IN THIRD
4508: ;       WORD OF BUFFER TO ITEM COUNT AND STORE IN THIRD WORD
4509: ;       OF HEADER (ITEM COUNT) ALSO SET BYTE POINTER (SECOND
4510: ;       WORD OF HEADER) AND RETURN TO USER.
4511: 
    UUOCON page# 0133 next  prev
4513: ; HERE IF INPUT NEEDS LOOKUP. GET FILE NAME FROM LOSER.
4514: 
4515: SETFILE:TYPE {PLEASE TYPE FILE NAME.}
4516:         INCHWL JOBTM5
4517:         MOVEI DAT,TTIBUF(DDB)   ;GODDAMN SYSTEM
4518:         PUSHJ P,CTEXT1          ; READ IN FILE NAME IF ANY
4519:         JUMPN TAC1,NOCLR
4520: CLRIN:  PUSHJ P,SKPBRK
4521:         JRST SETFILE
4522: NOCLR:  MOVEM TAC1,JOBTM1(PROG)
4523:         PUSHJ P,CTEXT1
4524:         HLLZM TAC1,JOBTM2(PROG)
4525:         SETZM JOBTM3(PROG)
4526:         PUSHJ P,PJPGNO
4527: IFE FTDSKPPN,<MOVE AC2,PRJPRG(J)>
4528: IFN FTDSKPPN,<  JRST    [SKIPN  AC2,DSKPPN(J)   ;DA, WHICH WAY DID 'E GO BOSS
4529:                         MOVE    AC2,PRJPRG(J)
4530:                         JRST    .+1]>
4531:         MOVEM   AC2,JOBTM4(PROG)
4532:         PUSHJ   P,SKPBRK
4533:         POPJ    P,
4534: 
4535: 
4536: IN:    MOVE TAC,DEVMOD(DDB)
4537:         TLNE TAC,DVDSK
4538:         TLNE DDB,LOOKB          ; DOES THIS DEVICE NEED A LOOKUP?
4539:         JRST IN2                ; NO, FORGET IT.
4540:         PUSH P,UUO
4541:         PUSH P,UUOPC(J)
4542:         PUSH P,UCHN
4543:         TYPE {LOOKUP NEEDED.}
4544: IN4:    PUSHJ P,SETFILE
4545:         MOVE UUO,[LOOKUP JOBTM1]
4546:         MOVE UCHN,(P)
4547:         DPB UCHN,PUUOAC
4548:         XCT UUO
4549:         CAIA
4550:         JRST IN5
4551:         TYPE {LOOKUP FAILED}
4552:         JRST IN4
4553: IN5:    POP P,UCHN
4554:         POP P,UUOPC(J)
4555:         POP P,UUO
4556:         MOVE DDB,USRJDA(UCHN)
4557:         HRRZ DSER,DEVSER(DDB)
4558:         MOVE IOS,DEVIOS(DDB)
    UUOCON page# 0134 next  prev
4560: ; INPUT UUO - HERE, WE ARE SATISFIED DEVICE IS PROPERLY LOOKED UP
4561: 
4562: IN2:    TLNE IOS,IO             ;IS THIS DEVICE ALREADY DOING OUTPUT?
4563:         PUSHJ PDP,WAIT1         ;YES, WAIT TILL IT IS FINISHED.
4564:         TLO DEVDAT,INPB         ;FOR THIS DEVICE.
4565:         TLZ DEVDAT,ICLOSB
4566:         HLLM DEVDAT,USRJDA(UCHN)        ;IN LH OF CURRENT JOB DEVICE CHANNEL
4567:         LDB TAC,PIOMOD          ;IO MODE
4568:         CAIE TAC,2              ;SAVE MODE?
4569:         CAIL TAC,SD             ;IT THE IO MODE DUMP(SD,D,DR)?
4570:         JRST INDMP              ;YES
4571:         TLNN DEVDAT,IBUFB       ;INPUT BUFFER HEADER SPECIFIED IN INIT?
4572:         JRST ADRERR             ;NO, FLUSH THE BASTARD!
4573: IN1:    HRR     JBUF,DEVBUF(DDB);NO, GET ADDRESS OF BUFFER HEADER
4574:         MOVSI   TAC,IOUSE       ;BUFFER IN USE BIT
4575:         MOVE    IOS,DEVIOS(DDB) ;GET A NEW COPY OF IOS
4576:         XCTR    XR,[SKIPG (JBUF)]       ;HAS A BUFFER RING BEEN SET UP (RH NON-ZERO)
4577:                                 ;WHICH HAS BEEN REFERENCED BY PREVIOUS INPUT (BIT0=0)
4578:         JRST    INPUTF          ;NO. GO SET UP BUFFER IF NECESSARY AND DO FIRST IO
4579:         PUSHJ   P,BCHECK        ;CHECK BUFFERS!
4580:         JRST    ADRERR          ;ADDRESS CHECK
4581:         XCTR    XR,[MOVE TAC1,(JBUF)]
4582:         MOVE    IOS,DEVIOS(DDB)         ;DEC 3.16
4583:         XCTR    XR,[TDNN TAC,(TAC1)]    ;DEC 3.16
4584:         JRST    INPT1                   ;DEC 3.16
4585:         XCTR    XRW,[ANDCAB TAC,(TAC1)]
4586:                                 ;FLAG CURRENT BUFFER AS FREE TO
4587:                                 ;RECEIVE MORE INPUT, CLEAR USE BIT
4588:                                 ;AND GET POINTER TO NEXT BUFFER
4589:         XCTR    XRW,[HRRM TAC,(JBUF)]   ;SET WORD 1 IN 3 WORD HEADER TO NEXT BUFFER
4590:         TRNE IOS,IOACT          ;IS THE DEVICE ALREADY ACTIVE
4591:         JRST INPT0C             ;YES
4592:         MOVE AC1,DEVMOD(DEVDAT) ;GET DEVICE CHARACTERISTIC WORD
4593:         TLNN AC1,DVTTY          ;IS IT A TTY?
4594:         XCTR    XR,[HRR TAC,(TAC)]      ;GET POINTER 1 BUFFER AHEAD OF NEXT BUFFER
4595:                                 ;IF NOT TTY.
4596:         XCTR    XR,[SKIPL (TAC)]        ;IS THE USE BIT SET?
4597:         PUSHJ   P,CALIN         ;NO, START SERVICE ROUTINE FILLING EMPTY BUFFER
    UUOCON page# 0135 next  prev
4599: ; INPUT UUO CONT.
4600: 
4601: INPT0C: XCTR    XR,[HRR TAC1,(TAC1)]    ;GET USE BIT FOR NEXT BUFFER
4602: INPT0A: XCTR    XR,[SKIPGE (TAC1)]      ;IS USE BIT SET YET?(BUFFER FILLED YET?)
4603:         JRST    INPUT2          ;YES, RETURN IMMEDIATELY TO USER
4604: INPT2:                          ;DEC 3.16
4605:         PUSHJ   P,WSYNC         ;NO, PUT JOB IN IO WAIT TILL BUFFER FILLED.
4606:         XCTR    XR,[SKIPL (TAC1)]       ;RETURN WHEN BUFFER FILLED. CHECK TO MAKE SURE.
4607:         JRST    INEOF           ;NO, MUST BE EOF OR ERROR
4608: INPUT2: ADDI    TAC1,1          ;YES, GET WORD COUNT AS SET BY IO SERVICE
4609:         XCTR    XR,[HRRZ ITEM,(TAC1)];RH OF 3RD WORD(FIRST SO-CALLED DATA WORD)
4610:         SOJA    TAC1,IOSETC     ;SET ITEM COUNT AND BYTE POINTER
4611:                                 ;IN 3 WORD HEADER AND RETURN TO USER
4612: INPT1:  TRNN    IOS,IOACT       ;DEC 3.16
4613:         PUSHJ   P,CALIN         ;DEC 3.16
4614:         JRST    INPT2           ;DEC 3.16
4615: 
4616: INEOF:  TDNN    IOS,[XWD IOEND,IODEND!IODERR!IOBKTL!IODTER!IOIMPM]
4617:                                 ;EOF OR ERROR BIT SET BY SERVICE ROUTINE
4618:         JRST    INEOFE          ;NO,
4619:         TLNE    IOS,IOEND       ;IS THIS EOF?
4620:         TRO     IOS,IODEND      ;YES, SET USER EOF BIT.
4621:         IORM    IOS,DEVIOS(DDB)
4622:         POPJ    P,              ;RETURN TO USER'S PROGRAM
4623: 
4624: INEOFE: JSP     DAT,UERROR      ;MONITOR ERROR AT UUO LEVEL
4625:         POPJ    P,
    UUOCON page# 0136 next  prev
4627: ;HERE ON FIRST INPUT AFTER INIT, INIT & LOOKUP, OR INIT & LOOKUP & INPUT
4628: INPUTF: XCTR    XRW,[ANDCAB TAC,(JBUF)]
4629:                                 ;MARK THAT BUFFERS HAVE BEEN REFER
4630:                                 ;BY CLEARING SIGN BIT OF 1ST WORD IN 3 WORD
4631:                                 ;IN 3 WORD BUFFER HEADER
4632:         JUMPE   TAC,INPUT3      ;HAS A RING BEEN SET UP YET?
4633:         PUSHJ   P,BCHECK
4634:         JRST    ADRERR          ;ADDRESS CHECK
4635:         XCTR    XR,[MOVE TAC1,(JBUF)]
4636:         XCTR    XR,[SKIPG (TAC1)]
4637:         JRST    INPUT2
4638:         HRRM    TAC,DEVIAD(DDB) ;YES, STORE ADR. OF 2ND WORD OF
4639:                                 ;A BUFFER FOR SERVICE ROUTINE
4640:         PUSHJ   P,CALIN         ;YES. GO START IO SERVICE ROUTINE
4641:                                 ;FILLING BUFFER
4642:         JRST    INPT0A
4643: 
4644: INPUT3: HRRI    UUO,2           ;BUFFERS NOT SETUP YET. - MAKE 2
4645:         PUSHJ   P,UINBF
4646:         HRRI    UUO,0           ;CLEAR RIGHT HALF
4647:         JRST    IN1
4648: 
4649: 
4650: INDMP:  PUSHJ   P,DDI(DSER)     ;CALL SERVICE ROUTINE
4651:         JRST    WSYNC           ;THEN WAIT TILL IO  FINISHED BEFORE
4652:                                 ;RETURNING TO USER.
4653:                                 ;*** NOTE: ADCSER THINKS IT CAN RETURN
4654:                                 ; TO USER WITHOUT WAITING BY
4655:                                 ; A `JRST TPOPJ', THUS SKIPPING WSYNC
    UUOCON page# 0137 next  prev
4657: ; CALL THE DEVICE INPUT ROUTIN
4658: 
4659: CALIN:  TLNE    IOS,IOEND
4660:         POPJ    P,
4661:         PUSH    P,TAC1
4662:         PUSH    P,JBUF
4663:         HRRZ    AC1,DEVIAD(DDB) ;IS FIRST ADR. ABOVE JOB DATA AREA?
4664:         CAIG    AC1,JOBPFI
4665:         JRST    ADRERR          ;NO, PRINT ERROR AND STOP JOB
4666:         XCTR    XR,[HLRZ AC2,(AC1)]     ;GET LENGTH OF BUFFER
4667:         TRZ     AC2,IOUSE       ;CLEAR USE BIT IN CASE IT IS ON(TTY)
4668:         ADD     AC1,AC2
4669:         XCTR    XRW,[MOVES (AC1)]       ; ADDRESS CHECK LAST ADDRESS OF BUFFER
4670:         PUSHJ   P,DIN(DSER)     ;DISPATCH TO IO SERVICE ROUTINE
4671:         POP     P,JBUF
4672:         POP     P,TAC1
4673:         POPJ    P,
4674: 
4675: BCHECK:MOVEI   AC1,(JBUF)
4676:         CAIG    AC1,JOBPFI      ;CHECK PROTECTED PART THIS WAY
4677:         POPJ    P,
4678:         XCTR    XRW,[MOVES AC1,(AC1)]   ;AND THE REST THIS WAY
4679:         HRRZ    AC1,AC1
4680:         CAIG    AC1,JOBPFI
4681:         POPJ    P,
4682:         XCTR    XRW,[MOVES (AC1)]
4683:         JRST    CPOPJ1
    UUOCON page# 0138 next  prev
4685: ; OUTPUT UUO - CALLING SEQUENCE
4686: ;     OUTPUT D,
4687: ;     EXIT
4688: ;OR
4689: ;     OUTPUT D, ADR
4690: ;     EXIT
4691: 
4692: ;IF INPUT IS ACTIVE, WAIT FOR IT TO COMPLETE.
4693: ;IF DUMP MODE WAS SELECTED BY THE LAST INIT UUO OR SETSTS UUO
4694: ;   THE PROGRAM WAITS UNTIL THE DEVICE IN INACTIVE AND THEN
4695: ;   WRITES THE DUMPFILE AND RETURNS CONTROL TO THE USER'S PROGRAM
4696: ;   WHEN IO HAS COMPLETED.
4697: ;IF THE MODE IS NOT DUMP, THEN
4698: ;1) IF ADR IS NOT ZERO, WAIT FOR DEVICE TO BECOME INACTIVE THEN SET THE
4699: ;   CURRENT BUFFER ADDRESS EQUAL TO ADR AND AN INDICATOR (JBFADR0)
4700: ;   SPECIFYING THAT THIS BUFFER RING HAS NEVER BEEN REFERENCED FROM THE
4701: ;   USER'S PROGRAM BY AN INPUT OR AN OUTPUT UUO.  OTHERWISE, GO TO
4702: ;   2) DIRECTLY.
4703: 
4704: ;2) IF THE BUFFER RING HAS NEVER BEEN REFERENCED (JBFADR0=1), THE
4705: ;   BUFFER IS CLEARED, IOUSE SET TO ZERO AND
4706: ;      IF THE CURRENT BUFFER ADDRESS IS ZERO, A TWO BUFFER RING IS SET UP.
4707: ;      THEN GO TO 8
4708: ;
4709: ;3) IF THE BUFFER RING HAS BEEN REFERENCED (JBFADR0=0   ,THEN A CHECK IS
4710: ;   MADE TO DETERMINE IF THE WORD COUNT IS TO BE COMPUTED.
4711: ;      IF THE WORD COUNT IS TO BE COMPUTED (IOWC=0), IT IS SET EQUAL
4712: ;      TO THE ADDRESS FOR THE LAST DATA WORD MINUS THE ADDRESS OF THE
4713: ;      BUFFER MINUS ONE.
4714: 
4715: ;4) IOUSE IS SET TO ONE, INDICATING THAT THE BUFFER IS FULL OR BEING
4716: ;   EMPTIED, AND THE CURRENT BUFFER ADDRESS IS ADVANCED.
4717: 
4718: ;5) IF THE DEVICE IS NOT ACTIVE (IOACT=0), OUTPUT IS STARTED.
4719: ;6) IF THE CURRENT BUFFER IS FULL OR BEING EMPTIED (IOUSE=1),
4720: ;   THE PROGRAM WAITS UNTIL THE DEVICE FINISHES THE BUFFER
4721: ;   (THE OUTPUT SERVICE ROUTINE CLEARS THE USE BIT WHEN
4722: ;   IT FINISHES OUTPUTTING A BUFFER).
4723: ;7) THE CURRENT BUFFER IS CLEARED.
4724: ;8) THE ITEM POINTER IS INITIATED TO THE CURRENT BUFFER ADDRESS+1
4725: ;   AND THE ITEM COUNT IS SET TO THE PRODUCT OF THE BUFFER SIZE
4726: ;   MINUS ONE AND THE INTEGER PART OF 36/BYTE SIZE.
4727: ;9) RETURN TO THE USER'S PROGRAM
    UUOCON page# 0139 next  prev
4729: ;HERE ON OUTPUT UUO
4730: 
4731: 
4732: UOUT:   MOVE TAC,DEVMOD(DDB)
4733:         TLNE TAC,DVDSK
4734:         TLNE DDB,ENTRB
4735:         JRST UOUT1
4736:         PUSH P,UUO
4737:         PUSH P,UUOPC(J)
4738:         PUSH P,UCHN
4739:         TYPE {ENTER NEEDED.}
4740: OUT4:   PUSHJ P,SETFILE
4741:         MOVE UUO,[LOOKUP JOBTM1]
4742:         MOVE UCHN,(P)
4743:         DPB UCHN,PUUOAC
4744:         PUSH P,JOBTM4(PROG)     ;LOOKUP CLOBBERS THIS.
4745:         XCT UUO
4746:         JRST OUT5               ;DOESN'T EXIST OR ERROR WILL BE DETECTED BY ENTER
4747:         POP P,JOBTM4(PROG)
4748:         TYPE {FILE ALREADY EXISTS. DELETE?}
4749:         INCHWL JOBTM5
4750:         MOVEI DAT,TTIBUF(DDB)
4751:         PUSHJ P,CTEXT1
4752:         PUSHJ P,SKPBRK
4753:         CAME TAC1,['Y     ']
4754:         CAMN TAC1,['YES   ']
4755:         JRST OURDN
4756:         JRST OUT4
4757: OUT5:   POP P,JOBTM4(PROG)      ;RESTORE PPN
4758: OURDN:  HLLZS JOBTM2(PROG)
4759:         SETZM JOBTM3(PROG)
4760:         MOVE UUO,[CLOSE]
4761:         MOVE UCHN,(P)
4762:         DPB UCHN,PUUOAC
4763:         XCT UUO                 ;MAKE SURE WE DON'T GET INTO ALTER MODE
4764:         MOVE UUO,[ENTER JOBTM1]
4765:         MOVE UCHN,(P)
4766:         DPB UCHN,PUUOAC
4767:         XCT UUO
4768:         CAIA
4769:         JRST OUT3
4770:         TYPE {ENTER FAILED}
4771:         JRST OUT4
4772: OUT3:   POP P,UCHN
4773:         POP P,UUOPC(J)
4774:         POP P,UUO
4775:         MOVE DDB,USRJDA(UCHN)
4776:         MOVE IOS,DEVIOS(DDB)
4777:         HRRZ DSER,DEVSER(DDB)
    UUOCON page# 0140 next  prev
4779: ; OUTPUT UUO - HERE WE ARE SATISFIED DEVICE HAS BEEN PROPERLY ENTERED
4780: 
4781: UOUT1:  TLO DEVDAT,OUTPB        ;SET OUTPUT UUO BIT
4782:         TLZ DEVDAT,OCLOSB       ;CLEAR CLOSE OUTPUT BIT
4783: 
4784: ;HERE FROM DEVICE SERVICE ROUTINES ON CLOSE UUO
4785: 
4786: OUT:   TLNN IOS,IO             ;IS THIS DEVICE ALREADY DOING INPUT?
4787:         PUSHJ PDP,WAIT1         ;YES, WAIT TILL IT BECOMES INACTIVE
4788:         HLLM DEVDAT,USRJDA(UCHN);SAVE NEW BIT SETTINGS.
4789:         LDB TAC,PIOMOD          ;GET DATA MODE SET BY INIT OR SETSTS.
4790:         CAIE TAC,2              ;SAVE MODE?
4791:         CAIL TAC,SD             ;IS IT DUMP MODE(SD,DR,D)?
4792:         JRST OUTDMP             ;YES.
4793:         TLNN DDB,OBUFB          ; IS THERE AN OUTPUT BUFFER HEADER?
4794:         JRST ADRERR             ; NO, ERROR
4795:         PUSHJ PDP,OUTA          ;NO, CHECK FOR NON-ZERO ADDRESS(USER
4796:                                 ;CHANGING RING)
4797:         HLR JBUF,DEVBUF(DEVDAT) ;REL. ADDR. OF OUTPUT BUFFER HEADER
4798:         XCTR XR,[SKIPG TAC1,(JBUF)]
4799:                                 ; CHECK FIRST WORD OF BUFFER HEADER
4800:         JRST OUTF               ;RING NOT SET UP OR FIRST REFERENCE TO RING
4801:         PUSHJ P,BCHECK          ;RING SET-UP, CHECK IT
4802:         JRST ADRERR             ;ADDRESS CHECK
4803:         XCTR XR,[SKIPG (TAC1)]  ;DID WE SOME HOW GET BACK TO HIM WITH NO FREE BUFFERS? RPH
4804:         JRST OUTAGN             ;YES, LET DEVICE WORRY ABOUT IT!  RPH
4805:         AOS JBUF                ;COMPUTE WORD COUNT FROM BYTE POINTER
4806:         XCTR XR,[HRRZ TAC,(JBUF)]       ;GET RH OF BYTE POINTER.
4807:         ADDI TAC1,1             ;REL. ADDR. OF 3RD WORD IN BUFFER.
4808:         SKIPN TAC               ;BYTE POINTER INITIALIZED ;DWP(JS)
4809:         TDZA TAC,TAC            ;NO. SET WORD COUNT = 0   ;DWP(JS)
4810:         SUB TAC,TAC1            ;DISTANCE FILLED BY USER.
4811:         TRNE IOS,IOWC           ;DOES USER WANT SYSTEM TO COMPUTE WORD
4812:                                 ;COUNT FROM BYTE POINTER?
4813:         JRST OUT2               ;NO.
4814:         HRRZ AC1,TAC1           ;YES, PROCEED IF ADDR. OF WORD COUNT IN BOUNDS
4815:         ADDI AC1,(TAC)          ;CHECK ENDING ADDRESS.
4816:         XCTR XRW,[MOVES (AC1)]
4817:         SOJ TAC1,               ; BACK UP POINTER TO LENGTH AND LINK WORD
4818:         XCTR XLB,[LDB AC1,[POINT 17,(TAC1),17]]
4819:         CAMLE TAC,AC1           ; IS THERE MORE DATA THAN THERE IS BUFFER?
4820:         JRST ADRERR             ; YES, USER ERROR
4821:         AOJ TAC1,               ; RESET BUFFER WORD COUNT POINTER
4822:         XCTR XRW,[HRRM TAC,(TAC1)]      ;STORE WORD COUNT IN 3RD WORD OF BUFFER.
    UUOCON page# 0141 next  prev
4824: ; OUTPUT UUO - HERE, WE ADVANCE BUFFER ADDRESS, START OUTPUT, AND WAIT FOR
4825: ; OUTPUT TO FINISH BEFORE RETURNING TO USER
4826: 
4827: OUT2:   SUBI JBUF,1             ;REL. ADDR. OF 1ST WORD IN HEADER
4828:                                 ;(POINTER TO CURRENT BUFFER).
4829:         SUBI TAC1,1                     ;REL. ADDR. OF 2ND WORD IN BUFFER
4830:                                         ;(LINK TO NEXT BUFFER).
4831:         HRLZI TAC,IOUSE         ;FLAG CURRENT BUFFER CONTAINS ACTIVE DATA.
4832:         XCTR XRW,[IORB TAC,(TAC1)]
4833:         XCTR XRW,[HRRM TAC,(JBUF)]      ;ADVANCE CURRENT BUFFER ADDRESS
4834:         XCTR XRW,[HLLZS 1(JBUF)]        ; ZERO OUT RH OF BYTE PTR TO NOTE NOT YET INITIALIZED - DWP (JS) /JAM
4835: OUTAGN: XCTR XW,[SETZM 2(JBUF)] ;CAN'T USE NEXT BUFFER YET!!   RPH
4836:         MOVE IOS,DEVIOS(DEVDAT) ;IS DEVICE ACTIVE?
4837:         MOVSI AC1,DEVAOA        ; CAN WE CALL THIS SERVICE ROUTINE IF IOACT IS ON?
4838:         TDNN AC1,DEVCMR(DEVDAT) ; THIS BIT IN THIS WORD WILL TELL US
4839:         TRNN IOS,IOACT
4840:         PUSHJ PDP,DOU(DSER)     ;NO,START OUTPUT.
4841:         HLR JBUF,DEVBUF(DEVDAT) ;JBUF TO REL. ADDR. OF BUFFER HEADER
4842:         XCTR XR,[MOVE TAC1,(JBUF)];TAC1 TO REL. ADDR. OF 2ND WORD OF BUFFER.
4843:         XCTR XR,[SKIPL (TAC1)]  ;HAS SERVICE ROUTINE EMPTIED NEXT BUFFER
4844:         JRST OUTS               ;YES, CLEAR AND RETURN
4845:         TRNE IOS,740000         ;ANY ERRORS TO SHOW LOSER?   RPH
4846:         POPJ P,                 ;YES, LET HIM SEE THEM       RPH
4847:         PUSHJ P,WSYNC           ;NO, WAIT.
4848:         JRST OUTS               ;CLEAR BUFFER AND RETURN TO LOSER, HOPING THAT THE BUFFER IS NOW REALLY FREE
4849: 
4850: OUTF:   XCTR XR,[SKIPE TAC1,(JBUF)]
4851:         JRST OUTF1
4852:         HRRI UUO,2
4853:         PUSHJ PDP,UOUTBF
4854:         HLR JBUF,DEVBUF(DEVDAT)
4855: OUTF1:  PUSHJ P,BCHECK          ;CHECK BUFFER ADDRESSES
4856:         JRST ADRERR             ;ADDRESS CHECK
4857:         MOVSI   TAC,IOUSE
4858:         XCTR XRW,[ANDCAB TAC,(JBUF)];IOUSE:=0
4859:         HRRM TAC,DEVOAD(DEVDAT)
4860: OUTS:   XCTR XR,[HRRZ TAC,(JBUF)]       ;CLEAR NEXT OUTPUT BUFFER.
4861:         PUSHJ   P,BUFCLR        ;BEING CLEARED.
4862:         JRST    ADRERR          ;ADDRESS CHECK
4863:         XCTR    XR,[HRR TAC1,(JBUF)]
4864:         XCTR    XLB,[LDB ITEM,[POINT 17,(TAC1),17]]
4865:         SOJA    ITEM,IOSETC
4866:                                 ;ADDRESS+1
4867:                                 ;JBFCTR:=(BUFFER SIZE-1)*[36/BYTE
4868:                                 ;SIZE]
4869:                                 ;RETURN TO USER'S PROGRAM
4870: 
4871: OUTDMP: PUSHJ PDP,DDO(DSER)
4872:                                 ;NOTE THAT XGPSER (AND ADCSER) THINKS IT CAN RETURN
4873:                                 ;WITHOUT WAITING BY JRST TPOPJ
4874:         JRST WSYNC              ;WAIT BEFORE RETURNING TO USER
    UUOCON page# 0142 next  prev
4876: ; SUBROUTINE FOR OUTPUT UUO
4877: ;CALLING SEQUENCE:
4878: ;       PUSHJ PDP,OUTA
4879: ;       EXIT            ALWAYS RETURNS HERE
4880: ;IF THE ADDRESS FIELD OF AC UUO IS ZERO,EXIT. OTHERWISE,CHECK IOACT.
4881: ;IF IOACT=1, WAIT FOR IOACT=0.
4882: ;SET JBFADR18-35:=ADDRESS FIELD OF AC UUO. JBFADR0:=1 AND EXIT.
4883: 
4884: OUTA:  TRNN    UUO,777774              ;IS BUFFER ADDRESS SPECIFIED?
4885:         POPJ    P,                      ;NO
4886:         PUSHJ   P,WAIT1
4887:         HLR     JBUF,DEVBUF(DDB)
4888:         XCTR    XRW,[HRRM UUO,(JBUF)]
4889:         HRRM    UUO,DEVOAD(DDB)
4890:         MOVSI   TAC,IOUSE
4891:         XCTR    XRW,[IORM TAC,(JBUF)]
4892:         POPJ    P,                      ;RETURN
    UUOCON page# 0143 next  prev
4894: ;RELEASE A DEVICE
4895: 
4896: 
4897: RELEA0:
4898: RELEA3:
4899:         TRZ     UUO,-1          ;CLOSE BOTH INPUT AND OUTPUT.  HERE FROM IORELS
4900: RELEA1:                        ;ALLOW SUPPRESION ON RELEASE UUO
4901:         PUSHJ   P,CLOSE1
4902:         HRRZ    TAC,DEVSER(DDB) ;DISPATCH ADDRESS IS THE ONLY THING RELEVANT
4903:         CAIN    TAC,(DSER)      ;COMPARE
4904:         JRST    RELE1A
4905:         PUSHACS
4906:         PUSH    P,(DDB)         ;DEVICE NAME
4907:         MOVE    TAC,DSER
4908:         PUSHJ   P,DISOCT
4909:         PUSHJ   P,DISMES
4910:         ASCIZ   / DSER CLOBBERED BY CLOSE1 AT RELEA1. /
4911:         POP     P,TAC1
4912:         PUSHJ   P,DISSIX
4913:         PUSHJ   P,DISTAB
4914:         PUSHJ   P,DISJOB
4915:         PUSHJ   P,DISCRLF
4916:         POPACS
4917:         MOVE    DSER,DEVSER(DDB)
4918: RELE1A: PUSHJ   P,WAIT1         ;WAIT FOR DEVICE TO BECOME INACTIVE
4919: RELEA5:
4920:         PUSHJ   P,DRL(DSER)             ;DISPATCH TO DEVICE SERVICE ROUTINE
4921:         MOVEI   IOS,IOACT               ;CLEAR IO ACTIVE BIT
4922:         ANDCAB  IOS,DEVIOS(DDB)         ;AND RETURN WITH IOS SET
4923:         SETZB   DAT,USRJDA(UCHN)        ;CLEAR DEVICE ASSIGNMENT
4924:         SKIPGE  TAC,USRHCU(PID)
4925:         MOVEI   TAC,17
4926: RELEA4: HRRZ    TAC1,USRJDA(TAC)
4927:         JUMPN   DAT,RELE4A              ;NON-ZERO CHAN. ALREADY?
4928:         MOVE    DAT,TAC1                ;NO, SET DAT WHEN FIRST(HIGHEST) FOUND
4929:         MOVEM   TAC,USRHCU(PID)         ;STORE HIGHEST IN USE CHANNEL
4930: RELE4A: CAIE    TAC1,(DDB)              ;IS THIS DEVICE SAME AS ONE BEING RELEASED?
4931:         SOJGE   TAC,RELEA4
4932:         JUMPGE  TAC,CPOPJ       ;DON'T FLUSH THIS DDB IF OPEN ON ANOTHER CHANNEL
4933:         HLLZS   DEVIAD(DDB)     ;CLEAR INPUT BUFFER ADDRESS
4934:         HLLZS   DEVOAD(DDB)     ;AND OUTPUT BUFFER ADDRESS.
4935: 
4936: ;CALLED FROM ERROR STOP ROUTINE(ESTOP)
4937: RELEA9:
4938:         MOVE    TAC,DEVNAM(DDB)         ;IS THIS SYSTEM TAPE?
4939:         CAME    TAC,[SIXBIT /DSK/]      ;DSK IS NEVER QUEUED
4940:         CAME    TAC,SYSTAP
4941:         JRST    RELEA7                  ;IS DISK OR NOT SYSTEM TAPE
4942:         MOVSI   TAC,777760              ;PREPARE TO ZERO OUT MOST OF DEVIAD AND DEVOAD
4943:         ANDCAM  TAC,DEVIAD(DDB)
4944:         ANDCAM  TAC,DEVOAD(DDB)
4945:         SKIPN   STUSER                  ;HAS COUNT ALREADY BEEN REDUCED AT ESTOP?
4946:         JRST    RELEA7                  ;YES
4947:         SETZM   STUSER                  ;YES, CLEAR SYSTEM USER NO.
4948:         SOSL    STREQ                   ;YES, REDUCE COUNT
4949:         SETOM   STAVAL                  ;SOMEONE IS WAITING, SET AVAILABLE FLAG/
4950: RELEA7: MOVEI   TAC1,ASSPRG             ;CLEAR ASSIGNED BY PROGRAM BIT
4951: RELEA6:
4952:         ANDCAB  TAC1,DEVMOD(DDB)        ;CALLED FROM DEASSIGN
4953:         TRZ     TAC1,777                ;CLEAR JOB NO. FIELD
4954:         TDNE    TAC1,[XWD TTYATC,ASSCON+ASSPRG]
4955:         POPJ    P,                      ;DEVICE ASSIGNED BY OTHER MEANS TOO
4956:         DPB     TAC1,PJOBN              ;CLEAR JOB NUMBER
4957:         MOVE    TAC1,DEVCMR(DDB)
4958:         TLNN    TAC1,DEVSHR             ;SHARABLE DEV?
4959:         JRST    RELDVW                  ;NO - WAKE UP WAITERS IF ANY
4960:         PUSH P,DAT              ; IF AT COMMAND LEVEL, SAVE TTY POINTER
4961:         PUSH P,DDB              ; AND DDB ADDRESS
4962:         PUSH P,DSER
4963:         HRRZ DSER,DEVSER(DDB)   ;GET POINTER TO DEVICE DEPENDENT ROUTINES
4964:         PUSHJ PDP,DGIVDD(DSER)  ;RETURN DDB TO STORAGE
4965:         POP P,DSER
4966:         POP P,DDB
4967:         POP P,DAT               ; RESTORE COMMAND POINTER
4968:         POPJ P,
    UUOCON page# 0144 next  prev
4970: ; RELEAS CODE - SEE IF THERE IS ANYONE WAITING FOR THE DEVICE
4971: ; IF SO, WAKE HIM UP.
4972: 
4973: RELDVW: PUSH P,DDB
4974:         PUSH P,UUO
4975:         PUSH P,DAT
4976:         PUSH P,J                ;SAVE OLD JOB NUMBER
4977:         HRRZS DDB
4978:         MOVEI DAT,DVWSCAN       ; SCAN ALL JOBS IN DEVICE WAIT
4979:         JSP UUO,QSCAN
4980:         JRST RELDVX
4981:         CAME DDB,JBTDVW(J)
4982:         JRST (AC1)              ; GO RESCAN
4983:         MOVEI AC1,RUNQ
4984:         MOVNM AC1,JOBQUE(J)     ; WAKE HIM UP
4985:         PUSHJ P,REQUE
4986: RELDVX: POP P,J
4987:         POP P,DAT
4988:         POP P,UUO
4989:         POP P,DDB
4990:         POPJ P,
    UUOCON page# 0145 next  prev
4992: ; UUOS TO TEST IO STATUS WORD
4993: ;CALLING SEQUENCE
4994: ;       STATO D,MASK
4995: ;       EXIT1           ALL SELECTED BITS ARE 0
4996: ;       EXIT2           SOME SELECTED BITS ARE 1
4997: ;TESTS BITS OF I/O STATUS WORD OF DEVICE ON USER'S CHANNEL D WHICH
4998: ;ARE SELECTED BY MASK.
4999: 
5000: 
5001: USTATO:
5002:         TRNE IOS,(UUO)          ; SKIP IF ANY INDICATED BITS ARE ONE
5003:         AOS (PDP)
5004:         POPJ PDP,               ;RETURN TO USER
    UUOCON page# 0146 next  prev
5006: ; MORE STATUS UUOS
5007: ;CALLING SEQUENCE
5008: ;       GETSTS D,ADR
5009: ;       EXIT            ALWAYS RETURNS HERE
5010: ;STORES I/O STATUS WORD OF DEVICE ON CHANNEL D IN LOCATION ADR.
5011: 
5012: 
5013: 
5014: 
5015: USTATS:
5016:         HRRZ TAC,IOS            ; GET USER HALF OF IOS
5017:         JRST STOTAC             ;ADDRESS CHECK AND STORE IN USER AREA
    UUOCON page# 0147 next  prev
5019: ; STILL MORE STATUS UUOS
5020: ;CALLING SEQUENCE
5021: ;       STATZ D,MASK
5022: ;       EXIT1           SOME SELECTED BITS ARE 1
5023: ;       EXIT2           ALL SELECTED BITS ARE 0
5024: 
5025: ;TESTS BITS OF I/O STATUS WORD OF DEVICE ON USER'S
5026: ;CHANNEL D WHICH ARE SELECTED BY MASK.
5027: 
5028: 
5029: USTATZ:
5030:         TRNN IOS,(UUO)          ; SKIP IF ALL INDICATED BITS ARE ZERO
5031:         AOS (PDP)
5032:         POPJ PDP,               ;RETURN TO USER
5033: 
5034: 
5035: 
    UUOCON page# 0148 next  prev
5037: ;IN UUO - LIKE INPUT    SKIPS IF  EOF OR ERRORS
5038: 
5039: 
5040: TIN:   PUSHJ PDP,IN            ;DO INPUT UUO
5041:         TRNE IOS,IOBKTL+IODTER+IODERR+IOIMPM+IODEND
5042:         AOS (PDP)
5043:         POPJ PDP,
5044: 
5045: 
5046: ;OUT UUO - LIKE OUTPUT  -  SKIPS IF ERRORS
5047: 
5048: 
5049: TOUT:  PUSHJ PDP,UOUT          ;DO OUTPUT UUO
5050:         TRNE IOS,IOBKTL+IODTER+IODERR+IOIMPM
5051:         AOS (PDP)
5052:         POPJ PDP,
5053: 
5054: 
    UUOCON page# 0149 next  prev
5056: ;SPACEWAR UUOS
5057: 
5058: SPCWGO: MOVEI   UUO,(TAC)               ;SETUP STARTING ADDRESS.
5059:         HLLZ    UCHN,TAC                ;MODE BITS IN UCHN LEFT
5060:         HLR     UCHN,TAC                ;TICKS IN UCHN RIGHT
5061:         AND     UCHN,[740000,,17]       ;FLUSH IRRELEVANT BITS
5062:         JRST    SPCWG1
5063: 
5064: ;UUO43 IS THE SPACEWAR UUO.  SEE SPWSER FOR MORE DETAILS - JS
5065: 
5066: USPCWAR:ANDI    UCHN,17         ;TICKS ONLY
5067: SPCWG1: MOVE TAC,JBTPRV(J)
5068:         TLNE TAC,LUPPRV
5069:         JRST    SPWCON          ;LET SPACE WAR SERVICE FIGURE OUT WHAT TO DO
5070:         JRST    UUOERR          ;ILLEGAL FOR REMOTE JOBS
5071:         BEND    APRSER
 EOF: UUOCON end-of-file. cnt=148